Passed
Push — master ( f19808...c54937 )
by Tõnis
07:18
created
views/_country-region-row.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,13 +43,16 @@
 block discarded – undo
43 43
                 'value' => !is_null($country) ? (new AddressHelper())->formatList($country->getDivisions()) : [],
44 44
             ],
45 45
         ]);?>
46
-    <?php else:?>
46
+    <?php else {
47
+    :?>
47 48
         <?= $form->field($model, 'state')->widget(Select2::class, [
48 49
             'data'=>  ArrayHelper::map((new AddressHelper())->formatList($country->getDivisions()),'id', 'name'),
49 50
             'options' => [
50 51
                 'placeholder' => $widget->placeHolders['state'],
51 52
             ],
52
-        ]);?>
53
+        ]);
54
+}
55
+?>
53 56
     <?php endif;?>
54 57
     </div>
55 58
 </div>
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use tonisormisson\addressform\AddressHelper;
10 10
 use yii\helpers\ArrayHelper;
11 11
 
12
-$country =$widget->getCountry();
12
+$country = $widget->getCountry();
13 13
 $countryDisabled = (count($widget->allowedCountries) < 2 and !empty($widget->allowedCountries));
14 14
 ?>
15 15
 
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
             'pluginOptions'=>[
28 28
                 'placeholder' => $widget->placeHolders['country'],
29 29
             ],
30
-        ]);?>
31
-        <?= $countryDisabled ?  $form->field($model, 'country')->hiddenInput(['value'=> $country->getIsoAlpha2()])->label(false) : null ?>
30
+        ]); ?>
31
+        <?= $countryDisabled ? $form->field($model, 'country')->hiddenInput(['value'=> $country->getIsoAlpha2()])->label(false) : null ?>
32 32
     </div>
33 33
 
34 34
     <div class="col-sm-6">
35
-    <?php if(is_null($country)):?>
35
+    <?php if (is_null($country)):?>
36 36
         <?= $form->field($model, 'state')->widget(DepDrop::class, [
37 37
             'type'=>DepDrop::TYPE_SELECT2,
38 38
             'select2Options'=>['pluginOptions'=>['allowClear'=>true]],
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
                 'loadingText' => Yii::t("addressform", "Loading") . "...",
44 44
                 'value' => !is_null($country) ? (new AddressHelper())->formatList($country->getDivisions()) : [],
45 45
             ],
46
-        ]);?>
46
+        ]); ?>
47 47
     <?php else:?>
48 48
         <?= $form->field($model, 'state')->widget(Select2::class, [
49
-            'data'=>  ArrayHelper::map((new AddressHelper())->formatList($country->getDivisions()),'id', 'name'),
49
+            'data'=>  ArrayHelper::map((new AddressHelper())->formatList($country->getDivisions()), 'id', 'name'),
50 50
             'options' => [
51 51
                 'placeholder' => $widget->placeHolders['state'],
52 52
             ],
53
-        ]);?>
54
-    <?php endif;?>
53
+        ]); ?>
54
+    <?php endif; ?>
55 55
     </div>
56 56
 </div>
Please login to merge, or discard this patch.
views/form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
             <?= (in_array('postCode', $widget->disabledFields)) ? null: $form->field($model, 'postCode')->textInput(['placeholder'=>$widget->placeHolders['postCode']]) ?>
23 23
         </div>
24 24
     </div>
25
-    <?= empty($widget->form) ? Html::submitButton($widget->submitText,$widget->submitOptions) : null?>
25
+    <?= empty($widget->form) ? Html::submitButton($widget->submitText, $widget->submitOptions) : null?>
26 26
 
27 27
 <?php (empty($widget->form)) ? ActiveForm::end() : null?>
28 28
 <?= Html::endTag("div")?>
29 29
\ No newline at end of file
Please login to merge, or discard this patch.
AddressForm.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -160,10 +160,10 @@
 block discarded – undo
160 160
             $this->address->country = $this->country->getIsoAlpha2();
161 161
         }
162 162
         if(!empty($this->defaultCountry)) {
163
-          if(!in_array($this->defaultCountry, $this->allowedCountries) && !empty($this->allowedCountries))  {
164
-              throw new ErrorException("the set defaultCounty '{$this->defaultCountry}' must be one of the configured allowedCountries");
165
-          }
166
-          $this->country = country($this->defaultCountry);
163
+            if(!in_array($this->defaultCountry, $this->allowedCountries) && !empty($this->allowedCountries))  {
164
+                throw new ErrorException("the set defaultCounty '{$this->defaultCountry}' must be one of the configured allowedCountries");
165
+            }
166
+            $this->country = country($this->defaultCountry);
167 167
         }
168 168
 
169 169
         if (empty($this->submitText)) {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
         $countryList = [];
102 102
         foreach ($this->countries as $country) {
103
-            $countryList[$country->getIsoAlpha2()] = $country->getEmoji(). " " . $country->getName();
103
+            $countryList[$country->getIsoAlpha2()] = $country->getEmoji() . " " . $country->getName();
104 104
         }
105 105
         return $countryList;
106 106
     }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             $params = [];
141 141
             if (!empty($this->disabledFields)) {
142 142
                 $requiredFields = array_diff(Address::$defaultRequiredFields, $this->disabledFields);
143
-                $params['requiredFields'] =  $requiredFields;
143
+                $params['requiredFields'] = $requiredFields;
144 144
             }
145 145
             $this->address = new Address($params);
146 146
         }
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
             $this->country = country($this->allowedCountries[0]);
150 150
             $this->address->country = $this->country->getIsoAlpha2();
151 151
         }
152
-        if(!empty($this->defaultCountry)) {
153
-          if(!in_array($this->defaultCountry, $this->allowedCountries) && !empty($this->allowedCountries))  {
152
+        if (!empty($this->defaultCountry)) {
153
+          if (!in_array($this->defaultCountry, $this->allowedCountries) && !empty($this->allowedCountries)) {
154 154
               throw new ErrorException("the set defaultCounty '{$this->defaultCountry}' must be one of the configured allowedCountries");
155 155
           }
156 156
           $this->country = country($this->defaultCountry);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             'addressLine2' => Yii::t("addressform", "2nd floor, room 203"),
183 183
         ];
184 184
         foreach ($defaults as $key => $value) {
185
-            if(!isset($this->placeHolders[$key])) {
185
+            if (!isset($this->placeHolders[$key])) {
186 186
                 $this->placeHolders[$key] = $value;
187 187
             }
188 188
         }
Please login to merge, or discard this patch.