@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | // add extra classes |
31 | 31 | $previous->walk( |
32 | - function ($e) { |
|
32 | + function($e) { |
|
33 | 33 | if ($e instanceof HTMLNode) { |
34 | 34 | if ($e->getTag() === 'input') { |
35 | 35 | $e->setTag('v-color-picker'); |
@@ -27,7 +27,7 @@ |
||
27 | 27 | { |
28 | 28 | // add extra classes |
29 | 29 | $previous->walk( |
30 | - function ($e) { |
|
30 | + function($e) { |
|
31 | 31 | if ($e instanceof HTMLNode) { |
32 | 32 | if ($e->getTag() === 'input') { |
33 | 33 | $e->setTag('v-date-picker'); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | /** @var HTMLNode $base */ |
24 | 24 | $base = $this->_editable($value, $field, $previous); |
25 | 25 | |
26 | - $base->filter(function ($e) { |
|
26 | + $base->filter(function($e) { |
|
27 | 27 | if ($e instanceof HTMLNode) { |
28 | 28 | if ($e->getTag() === 'label') { |
29 | 29 | return false; |
@@ -26,22 +26,22 @@ |
||
26 | 26 | |
27 | 27 | foreach ($validators as $validator => $data) { |
28 | 28 | switch ($validator) { |
29 | - case MinLength::class: |
|
30 | - $element->setAttribute('minlength', $field->getValidatorOption($validator, 'value', '')); |
|
31 | - break; |
|
32 | - case MaxLength::class: |
|
33 | - $element->setAttribute('maxlength', $field->getValidatorOption($validator, 'value', '')); |
|
34 | - $element->setAttribute('mgmvlength', 'xxxxxxxxxxx'); |
|
35 | - break; |
|
36 | - case Regex::class: |
|
37 | - $pattern = $field->getValidatorOption($validator, 'value', ''); |
|
38 | - if ($pattern[0] === '/' && $pattern[-1] === '/') { |
|
39 | - $pattern = mb_substr($pattern, 1, mb_strlen($pattern) - 2); |
|
40 | - } |
|
41 | - $element->setAttribute('pattern', $pattern); |
|
42 | - break; |
|
43 | - default: |
|
44 | - break; |
|
29 | + case MinLength::class: |
|
30 | + $element->setAttribute('minlength', $field->getValidatorOption($validator, 'value', '')); |
|
31 | + break; |
|
32 | + case MaxLength::class: |
|
33 | + $element->setAttribute('maxlength', $field->getValidatorOption($validator, 'value', '')); |
|
34 | + $element->setAttribute('mgmvlength', 'xxxxxxxxxxx'); |
|
35 | + break; |
|
36 | + case Regex::class: |
|
37 | + $pattern = $field->getValidatorOption($validator, 'value', ''); |
|
38 | + if ($pattern[0] === '/' && $pattern[-1] === '/') { |
|
39 | + $pattern = mb_substr($pattern, 1, mb_strlen($pattern) - 2); |
|
40 | + } |
|
41 | + $element->setAttribute('pattern', $pattern); |
|
42 | + break; |
|
43 | + default: |
|
44 | + break; |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 |
@@ -23,12 +23,11 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function expandJS(array $data): array |
25 | 25 | { |
26 | - return array_map(function ($key, $value) { |
|
26 | + return array_map(function($key, $value) { |
|
27 | 27 | return "$key" . |
28 | 28 | ( |
29 | 29 | is_array($value) ? |
30 | - ': {' . implode(",\n", expandJS($value)) . '}' : |
|
31 | - ($value ? ':' . $value : '') |
|
30 | + ': {' . implode(",\n", expandJS($value)) . '}' : ($value ? ':' . $value : '') |
|
32 | 31 | ); |
33 | 32 | }, array_keys($data), $data); |
34 | 33 | } |
@@ -263,7 +262,7 @@ discard block |
||
263 | 262 | */ |
264 | 263 | protected function serializeProps(array $props): string |
265 | 264 | { |
266 | - $s = array_map(function ($p) { |
|
265 | + $s = array_map(function($p) { |
|
267 | 266 | return "'{$p['name']}': { 'type': {$p['type']}" . ($p['required'] ?? false ? ", 'required': true" : '') . " } "; |
268 | 267 | }, $props); |
269 | 268 | return "{\n " . implode(",\n ", $s) . "\n }"; |
@@ -282,7 +281,7 @@ discard block |
||
282 | 281 | $props = $this->props($m); |
283 | 282 | // get only props names |
284 | 283 | $propsNames = array_map( |
285 | - function ($p) { |
|
284 | + function($p) { |
|
286 | 285 | return $p['name']; |
287 | 286 | }, |
288 | 287 | $props |
@@ -293,7 +292,7 @@ discard block |
||
293 | 292 | $propsNames = array_combine($propsNames, $propsNames); |
294 | 293 | // get the binding |
295 | 294 | $propsBind = array_map( |
296 | - function ($p) { |
|
295 | + function($p) { |
|
297 | 296 | return 'v-bind:' . $p . '="model.' . $p . '"'; |
298 | 297 | }, |
299 | 298 | array_keys($props) |
@@ -320,13 +319,13 @@ discard block |
||
320 | 319 | 'propsBind' => implode(' ', $propsBind), |
321 | 320 | 'imports' => implode( |
322 | 321 | "\n", |
323 | - array_map(function ($key, $value) { |
|
322 | + array_map(function($key, $value) { |
|
324 | 323 | return "import $key from \"$value\";"; |
325 | 324 | }, array_keys($this->imports), $this->imports) |
326 | 325 | ), |
327 | 326 | 'computedCode' => implode( |
328 | 327 | "\n", |
329 | - array_map(function ($key, $value) { |
|
328 | + array_map(function($key, $value) { |
|
330 | 329 | return "$key() { $value },"; |
331 | 330 | }, array_keys($this->computed), $this->computed) |
332 | 331 | ), |
@@ -336,7 +335,7 @@ discard block |
||
336 | 335 | ), |
337 | 336 | 'methodsCode' => implode( |
338 | 337 | "\n", |
339 | - array_map(function ($key, $value) { |
|
338 | + array_map(function($key, $value) { |
|
340 | 339 | return "$key { $value },"; |
341 | 340 | }, array_keys($this->methods), $this->methods) |
342 | 341 | ), |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | public static function getNames(): array |
159 | 159 | { |
160 | 160 | return static::map( |
161 | - function (\ReflectionClass $reflection) { |
|
161 | + function(\ReflectionClass $reflection) { |
|
162 | 162 | return static::getNamePair($reflection); |
163 | 163 | } |
164 | 164 | ); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | foreach (static::getBaseNamespaces() as $ns) { |
214 | 214 | $base = $ns . $subns; |
215 | 215 | $x = array_map( |
216 | - function ($f) use ($base) { |
|
216 | + function($f) use ($base) { |
|
217 | 217 | $fName = "$base\\$f\\CodeGenerator"; |
218 | 218 | return new $fName(); |
219 | 219 | }, |
@@ -24,7 +24,7 @@ |
||
24 | 24 | $choices = $datatype->getChoices(); |
25 | 25 | |
26 | 26 | $choicesTS = array_map( |
27 | - function ($c) { |
|
27 | + function($c) { |
|
28 | 28 | return " \"$c\" = \"$c\""; |
29 | 29 | }, |
30 | 30 | array_keys($choices) |
@@ -28,12 +28,12 @@ |
||
28 | 28 | { |
29 | 29 | $classes = DatatypeGeneratorFactory::specializedFactoryAll($this); |
30 | 30 | $declarations = array_map( |
31 | - function (DatatypeGenerator $c) { |
|
31 | + function(DatatypeGenerator $c) { |
|
32 | 32 | return $c->datatypeDeclaration($this); |
33 | 33 | }, |
34 | 34 | $classes |
35 | 35 | ); |
36 | - $cleanDeclarations = array_filter($declarations, function ($d) { |
|
36 | + $cleanDeclarations = array_filter($declarations, function($d) { |
|
37 | 37 | return $d; |
38 | 38 | }); |
39 | 39 | return join("\n\n", $cleanDeclarations); |
@@ -13,8 +13,8 @@ |
||
13 | 13 | { |
14 | 14 | try { |
15 | 15 | /** |
16 | - * @var Datatype_enum $datatype |
|
17 | - */ |
|
16 | + * @var Datatype_enum $datatype |
|
17 | + */ |
|
18 | 18 | $datatype = $this->getDatatype(); |
19 | 19 | |
20 | 20 | /** |
@@ -24,7 +24,7 @@ |
||
24 | 24 | $choices = $datatype->getChoices(); |
25 | 25 | |
26 | 26 | $choicesEscaped = array_map( |
27 | - function ($c) { |
|
27 | + function($c) { |
|
28 | 28 | $c = preg_replace("/[^A-Za-z0-9]+/s", "_", $c); |
29 | 29 | return ((ctype_alpha($c[0]) || $c[0] === '_') ? $c : '_' . $c); |
30 | 30 | }, |