@@ -133,7 +133,7 @@ |
||
133 | 133 | $this->getDocumentation() . |
134 | 134 | "\n\nRandom value example: " . var_export($this->getRandom(), true) . |
135 | 135 | "\n\nSQL datatype: `" . $this->getSQLType() . "`" . |
136 | - "\n\nLaravel SQL datatype: `" . $this->getLaravelSQLType('name') . "`", |
|
136 | + "\n\nLaravel SQL datatype: `" . $this->getLaravelSQLType('name') . "`", |
|
137 | 137 | [] |
138 | 138 | ); |
139 | 139 | } |
@@ -64,17 +64,17 @@ |
||
64 | 64 | $iconData[] = $icon; |
65 | 65 | $group = HTMLNode::factory( |
66 | 66 | 'div', |
67 | - [ 'class' => "input-group mb-3" ], |
|
67 | + ['class' => "input-group mb-3"], |
|
68 | 68 | [ |
69 | 69 | HTMLNode::factory( |
70 | 70 | 'div', |
71 | - [ 'class' => "input-group-prepend" ], |
|
71 | + ['class' => "input-group-prepend"], |
|
72 | 72 | HTMLNode::factory( |
73 | 73 | 'span', |
74 | - [ 'class' => "input-group-text" ], |
|
74 | + ['class' => "input-group-text"], |
|
75 | 75 | HTMLNode::factory( |
76 | 76 | 'i', |
77 | - [ 'class' => $iconData ], |
|
77 | + ['class' => $iconData], |
|
78 | 78 | [] |
79 | 79 | ) |
80 | 80 | ) |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | $shortopts = "v:p::t::"; |
8 | 8 | $longopts = array( |
9 | - "validator:", // Required value |
|
9 | + "validator:", // Required value |
|
10 | 10 | "namespace::", |
11 | 11 | "path::", |
12 | 12 | "test-path::" |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | |
20 | 20 | $validator = $options['validator']; |
21 | 21 | $namespace = $options['namespace'] ?? 'Formularium\\Validator'; |
22 | -$path = $options['path'] ?? "Formularium/Validator/" ; |
|
23 | -$testpath = $options['testpath'] ?? "tests/Validator" ; |
|
22 | +$path = $options['path'] ?? "Formularium/Validator/"; |
|
23 | +$testpath = $options['testpath'] ?? "tests/Validator"; |
|
24 | 24 | |
25 | 25 | $code = ValidatorFactory::generate( |
26 | 26 | $validator, |
@@ -28,17 +28,17 @@ |
||
28 | 28 | |
29 | 29 | foreach ($validators as $validator => $data) { |
30 | 30 | switch ($validator) { |
31 | - case MinLength::class: |
|
32 | - $element->setAttribute('minlength', $field->getValidatorOption($validator, 'value', '')); |
|
33 | - break; |
|
34 | - case MaxLength::class: |
|
35 | - $element->setAttribute('maxlength', $field->getValidatorOption($validator, 'value', '')); |
|
36 | - break; |
|
37 | - case Regex::class: |
|
38 | - $element->setAttribute('pattern', $field->getValidatorOption($validator, 'value', '')); |
|
39 | - break; |
|
40 | - default: |
|
41 | - break; |
|
31 | + case MinLength::class: |
|
32 | + $element->setAttribute('minlength', $field->getValidatorOption($validator, 'value', '')); |
|
33 | + break; |
|
34 | + case MaxLength::class: |
|
35 | + $element->setAttribute('maxlength', $field->getValidatorOption($validator, 'value', '')); |
|
36 | + break; |
|
37 | + case Regex::class: |
|
38 | + $element->setAttribute('pattern', $field->getValidatorOption($validator, 'value', '')); |
|
39 | + break; |
|
40 | + default: |
|
41 | + break; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 |
@@ -25,27 +25,27 @@ |
||
25 | 25 | $vueCode = $this->getVueCode(); |
26 | 26 | foreach ($validators as $validator => $data) { |
27 | 27 | switch ($validator) { |
28 | - case MinLength::class: |
|
29 | - $this->setValidations( |
|
30 | - $vueCode, |
|
31 | - $field, |
|
32 | - 'minLength', |
|
33 | - 'minLength(' . $field->getValidatorOption($validator, 'value', '') . ')' |
|
34 | - ); |
|
35 | - break; |
|
36 | - case MaxLength::class: |
|
37 | - $this->setValidations( |
|
38 | - $vueCode, |
|
39 | - $field, |
|
40 | - 'maxLength', |
|
41 | - 'maxLength(' . $field->getValidatorOption($validator, 'value', '') . ')' |
|
42 | - ); |
|
43 | - break; |
|
44 | - case Regex::class: |
|
45 | - // TODO |
|
46 | - break; |
|
47 | - default: |
|
48 | - break; |
|
28 | + case MinLength::class: |
|
29 | + $this->setValidations( |
|
30 | + $vueCode, |
|
31 | + $field, |
|
32 | + 'minLength', |
|
33 | + 'minLength(' . $field->getValidatorOption($validator, 'value', '') . ')' |
|
34 | + ); |
|
35 | + break; |
|
36 | + case MaxLength::class: |
|
37 | + $this->setValidations( |
|
38 | + $vueCode, |
|
39 | + $field, |
|
40 | + 'maxLength', |
|
41 | + 'maxLength(' . $field->getValidatorOption($validator, 'value', '') . ')' |
|
42 | + ); |
|
43 | + break; |
|
44 | + case Regex::class: |
|
45 | + // TODO |
|
46 | + break; |
|
47 | + default: |
|
48 | + break; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | protected function serializeProps(array $props): string |
239 | 239 | { |
240 | - $s = array_map(function ($p) { |
|
240 | + $s = array_map(function($p) { |
|
241 | 241 | return "'{$p['name']}': { 'type': {$p['type']}" . ($p['required'] ?? false ? ", 'required': true" : '') . " } "; |
242 | 242 | }, $props); |
243 | 243 | return "{\n " . implode(",\n ", $s) . "\n }\n"; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $jsonData = json_encode($data); |
257 | 257 | $props = $this->props($m); |
258 | 258 | $propsBind = array_map( |
259 | - function ($p) { |
|
259 | + function($p) { |
|
260 | 260 | return 'v-bind:' . $p . '="model.' . $p . '"'; |
261 | 261 | }, |
262 | 262 | array_keys($props) |
@@ -267,28 +267,28 @@ discard block |
||
267 | 267 | 'propsBind' => implode(' ', $propsBind), |
268 | 268 | 'imports' => implode( |
269 | 269 | "\n", |
270 | - array_map(function ($key, $value) { |
|
270 | + array_map(function($key, $value) { |
|
271 | 271 | // TODO: array |
272 | 272 | return "import $key from \"$value\";"; |
273 | 273 | }, array_keys($this->imports), $this->imports) |
274 | 274 | ), |
275 | 275 | 'computedCode' => implode( |
276 | 276 | "\n", |
277 | - array_map(function ($key, $value) { |
|
277 | + array_map(function($key, $value) { |
|
278 | 278 | // TODO: array |
279 | 279 | return "$key() { $value },"; |
280 | 280 | }, array_keys($this->computed), $this->computed) |
281 | 281 | ), |
282 | 282 | 'otherData' => implode( |
283 | 283 | "\n", |
284 | - array_map(function ($key, $value) { |
|
284 | + array_map(function($key, $value) { |
|
285 | 285 | return "$key: " . json_encode($value) . ",\n"; |
286 | 286 | }, array_keys($this->other), $this->other) |
287 | 287 | ), |
288 | 288 | 'methodsCode' => '{}', // TODO |
289 | 289 | 'extraData' => implode( |
290 | 290 | "\n", |
291 | - array_map(function ($key, $value) { |
|
291 | + array_map(function($key, $value) { |
|
292 | 292 | return " $key: $value,"; |
293 | 293 | }, array_keys($this->extraData), $this->extraData) |
294 | 294 | ) |