Skip to content

Commit fb7fde4

Browse files
committed
Update StripeForm.php
1 parent f361e5d commit fb7fde4

File tree

1 file changed

+51
-49
lines changed

1 file changed

+51
-49
lines changed

StripeForm.php

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,16 @@ public function registerJqueryPaymentScripts() {
245245
* @return string genetared input tag
246246
*/
247247
public function numberInput($options = []) {
248-
$mergedOptions = array_merge($options, [
249-
'id' => self::NUMBER_ID,
250-
'class' => 'form-control',
251-
'autocomplete' => self::AUTO_CC_ATTR,
252-
'placeholder' => '•••• •••• •••• ••••',
253-
'required' => true,
254-
'type' => 'tel',
255-
'size' => 20
256-
]);
257-
248+
$defaultOptions = [
249+
'id' => self::NUMBER_ID,
250+
'class' => 'form-control',
251+
'autocomplete' => self::AUTO_CC_ATTR,
252+
'placeholder' => '•••• •••• •••• ••••',
253+
'required' => true,
254+
'type' => 'tel',
255+
'size' => 20
256+
];
257+
$mergedOptions = array_merge($defaultOptions, $options);
258258
StripeHelper::secCheck($mergedOptions);
259259
$mergedOptions['data-stripe'] = self::NUMBER_ID;
260260
return Html::input('text', null, null, $mergedOptions);
@@ -266,15 +266,16 @@ public function numberInput($options = []) {
266266
* @return string genetared input tag
267267
*/
268268
public function cvcInput($options = []) {
269-
$mergedOptions = array_merge($options, [
270-
'id' => self::CVC_ID,
271-
'class' => 'form-control',
272-
'autocomplete' => 'off',
273-
'placeholder' => '•••',
274-
'required' => true,
275-
'type' => 'tel',
276-
'size' => 4
277-
]);
269+
$defaultOptions = [
270+
'id' => self::CVC_ID,
271+
'class' => 'form-control',
272+
'autocomplete' => 'off',
273+
'placeholder' => '•••',
274+
'required' => true,
275+
'type' => 'tel',
276+
'size' => 4
277+
];
278+
$mergedOptions = array_merge($defaultOptions, $options);
278279
StripeHelper::secCheck($mergedOptions);
279280
$mergedOptions['data-stripe'] = self::CVC_ID;
280281
return Html::input('text', null, null, $mergedOptions);
@@ -286,16 +287,17 @@ public function cvcInput($options = []) {
286287
* @return string genetared input tag
287288
*/
288289
public function yearInput($options = []) {
289-
$mergedOptions = array_merge($options, [
290-
'id' => self::YEAR_ID,
291-
'class' => 'form-control',
292-
'autocomplete' => self::AUTO_YEAR_ATTR,
293-
'placeholder' => '••••',
294-
'required' => true,
295-
'type' => 'tel',
296-
'maxlength' => 4,
297-
'size' => 4
298-
]);
290+
$defaultOptions = [
291+
'id' => self::YEAR_ID,
292+
'class' => 'form-control',
293+
'autocomplete' => self::AUTO_YEAR_ATTR,
294+
'placeholder' => '••••',
295+
'required' => true,
296+
'type' => 'tel',
297+
'maxlength' => 4,
298+
'size' => 4
299+
];
300+
$mergedOptions = array_merge($defaultOptions, $options);
299301
StripeHelper::secCheck($mergedOptions);
300302
$mergedOptions['data-stripe'] = self::YEAR_ID;
301303
return Html::input('text', null, null, $mergedOptions);
@@ -307,17 +309,17 @@ public function yearInput($options = []) {
307309
* @return string genetared input tag
308310
*/
309311
public function monthInput($options = []) {
310-
$mergedOptions = array_merge($options, [
311-
'id' => self::MONTH_ID,
312-
'class' => 'form-control',
313-
'autocomplete' => self::AUTO_MONTH_ATTR,
314-
'placeholder' => '••',
315-
'required' => true,
316-
'type' => 'tel',
317-
'maxlength' => 2,
318-
'size' => 2
319-
]);
320-
312+
$defaultOptions = [
313+
'id' => self::MONTH_ID,
314+
'class' => 'form-control',
315+
'autocomplete' => self::AUTO_MONTH_ATTR,
316+
'placeholder' => '••',
317+
'required' => true,
318+
'type' => 'tel',
319+
'maxlength' => 2,
320+
'size' => 2
321+
];
322+
$mergedOptions = array_merge($defaultOptions, $options);
321323
StripeHelper::secCheck($mergedOptions);
322324
$mergedOptions['data-stripe'] = self::MONTH_ID;
323325
return Html::input('text', null, null, $mergedOptions);
@@ -329,15 +331,15 @@ public function monthInput($options = []) {
329331
* @return string genetared input tag
330332
*/
331333
public function monthAndYearInput($options = []) {
332-
$mergedOptions = array_merge($options, [
333-
'id' => self::MONTH_YEAR_ID,
334-
'class' => 'form-control',
335-
'autocomplete' => self::AUTO_EXP_ATTR,
336-
'placeholder' => '•• / ••',
337-
'required' => true,
338-
'type' => 'tel',
339-
]);
340-
334+
$defaultOptions = [
335+
'id' => self::MONTH_YEAR_ID,
336+
'class' => 'form-control',
337+
'autocomplete' => self::AUTO_EXP_ATTR,
338+
'placeholder' => '•• / ••',
339+
'required' => true,
340+
'type' => 'tel',
341+
];
342+
$mergedOptions = array_merge($defaultOptions, $options);
341343
StripeHelper::secCheck($mergedOptions);
342344
$mergedOptions['data-stripe'] = self::MONTH_YEAR_ID;
343345
$inputs = Html::input('text', null, null, $mergedOptions);

0 commit comments

Comments
 (0)