Completed
Pull Request — master (#3075)
by
unknown
02:57
created
src/Form/Field/Select.php 2 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      *
41 41
      * @param array|callable|string $options
42 42
      *
43
-     * @return $this|mixed
43
+     * @return Select
44 44
      */
45 45
     public function options($options = [])
46 46
     {
@@ -96,6 +96,10 @@  discard block
 block discarded – undo
96 96
         return $this;
97 97
     }
98 98
 
99
+    /**
100
+     * @param string $key
101
+     * @param string $val
102
+     */
99 103
     private function template($key, $val)
100 104
     {
101 105
         $this->config['escapeMarkup'] = 'function (markup) {return markup;}';
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         if (is_callable($options)) {
62 62
             $this->options = $options;
63 63
         } else {
64
-            $this->options = (array)$options;
64
+            $this->options = (array) $options;
65 65
         }
66 66
 
67 67
         return $this;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $this->config['escapeMarkup'] = 'function (markup) {return markup;}';
102 102
 
103 103
         $key = strtolower($key);
104
-        $func_key = "template" . ucfirst($key);
104
+        $func_key = "template".ucfirst($key);
105 105
         $func_name = str_replace('.', '', "{$this->getElementClassSelector()}_{$key}");
106 106
         $this->config[$func_key] = $func_name;
107 107
         $script = implode("\n", [
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
 
165 165
         return implode(
166 166
             ",\n",
167
-            array_map(function ($u, $v) use ($functions) {
167
+            array_map(function($u, $v) use ($functions) {
168 168
                 if (is_string($v)) {
169 169
                     return  in_array($u, $functions) ? "{$u}: {$v}" : "{$u}: \"{$v}\"";
170 170
                 }
171 171
 
172
-                return "{$u}: " . json_encode($v);
172
+                return "{$u}: ".json_encode($v);
173 173
             }, array_keys($options), $options)
174 174
         );
175 175
     }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         );
192 192
         $configs = $this->buildJsJson($configs);
193 193
 
194
-        return $quoted ? '{' . $configs . '}' : $configs;
194
+        return $quoted ? '{'.$configs.'}' : $configs;
195 195
     }
196 196
 
197 197
     /**
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             throw new \InvalidArgumentException("[$model] must be a valid model class");
309 309
         }
310 310
 
311
-        $this->options = function ($value) use ($model, $idField, $textField) {
311
+        $this->options = function($value) use ($model, $idField, $textField) {
312 312
             if (empty($value)) {
313 313
                 return [];
314 314
             }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
     protected function loadRemoteOptions($url, $parameters = [], $options = [])
344 344
     {
345 345
         $ajaxOptions = [
346
-            'url' => $url . '?' . http_build_query($parameters),
346
+            'url' => $url.'?'.http_build_query($parameters),
347 347
         ];
348 348
 
349 349
         $configs = $this->configs([
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
      */
460 460
     public function render()
461 461
     {
462
-        Admin::js('https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/i18n/' . app()->getLocale() . '.js');
462
+        Admin::js('https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/i18n/'.app()->getLocale().'.js');
463 463
         $configs = str_replace("\n", '', $this->configs(
464 464
             [
465 465
                 'allowClear'  => true,
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
             'groups'  => $this->groups,
493 493
         ]);
494 494
 
495
-        $this->attribute('data-value', implode(',', (array)$this->value()));
495
+        $this->attribute('data-value', implode(',', (array) $this->value()));
496 496
 
497 497
         return parent::render();
498 498
     }
Please login to merge, or discard this patch.