@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $label = $base->get('label.formularium-label'); |
| 35 | 35 | if (!empty($label)) { |
| 36 | 36 | // delete |
| 37 | - $base->filter(function ($e) { |
|
| 37 | + $base->filter(function($e) { |
|
| 38 | 38 | return !($e->getTag() === 'label' && $e->getAttribute('class') === ['formularium-label']); |
| 39 | 39 | }); |
| 40 | 40 | // fix class |
@@ -19,10 +19,10 @@ |
||
| 19 | 19 | protected $mode = self::VUE_MODE_EMBEDDED; |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * The tag used as container for fields in viewable() |
|
| 23 | - * |
|
| 24 | - * @var string |
|
| 25 | - */ |
|
| 22 | + * The tag used as container for fields in viewable() |
|
| 23 | + * |
|
| 24 | + * @var string |
|
| 25 | + */ |
|
| 26 | 26 | protected $viewableContainerTag = 'div'; |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | protected function serializeProps(array $props): string |
| 214 | 214 | { |
| 215 | - $s = array_map(function ($name, $p) { |
|
| 215 | + $s = array_map(function($name, $p) { |
|
| 216 | 216 | return "'$name': { 'type': {$p['type']}" . ($p['required'] ?? false ? ", 'required': true" : '') . " } "; |
| 217 | 217 | }, array_keys($props), $props); |
| 218 | 218 | return "{\n " . implode(",\n ", $s) . "\n }\n"; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $jsonData = json_encode($data); |
| 227 | 227 | $props = $this->props($m); |
| 228 | 228 | $propsBind = array_map( |
| 229 | - function ($p) { |
|
| 229 | + function($p) { |
|
| 230 | 230 | return 'v-bind:' . $p . '="model.' . $p . '"'; |
| 231 | 231 | }, |
| 232 | 232 | array_keys($props) |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $jsonData = json_encode($data); |
| 290 | 290 | $props = $this->props($m); |
| 291 | 291 | $propsBind = array_map( |
| 292 | - function ($p) { |
|
| 292 | + function($p) { |
|
| 293 | 293 | return 'v-bind:' . $p . '="model.' . $p . '"'; |
| 294 | 294 | }, |
| 295 | 295 | array_keys($props) |
@@ -125,7 +125,7 @@ |
||
| 125 | 125 | public function serialize(): array |
| 126 | 126 | { |
| 127 | 127 | $fields = array_map( |
| 128 | - function ($f) { |
|
| 128 | + function($f) { |
|
| 129 | 129 | return [ |
| 130 | 130 | 'datatype' => $f->getDatatype()->getName(), |
| 131 | 131 | 'validators' => $f->getValidators(), |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | public function toGraphql(): string |
| 31 | 31 | { |
| 32 | 32 | $args = array_map( |
| 33 | - function (ValidatorArgs $a) { |
|
| 33 | + function(ValidatorArgs $a) { |
|
| 34 | 34 | return $a->toGraphql(); |
| 35 | 35 | }, |
| 36 | 36 | $this->args |
@@ -2,9 +2,9 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | require('vendor/autoload.php'); |
| 4 | 4 | |
| 5 | -$shortopts = "d:b::n::p::t::"; |
|
| 6 | -$longopts = array( |
|
| 7 | - "datatype:", // Required value |
|
| 5 | +$shortopts = "d:b::n::p::t::"; |
|
| 6 | +$longopts = array( |
|
| 7 | + "datatype:", // Required value |
|
| 8 | 8 | "basetype::", |
| 9 | 9 | "namespace::", |
| 10 | 10 | "path::", |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | $datatype = $options['datatype']; |
| 20 | 20 | $basetype = $options['basetype'] ?? ''; |
| 21 | 21 | $namespace = $options['namespace'] ?? 'Formularium\Datatype'; |
| 22 | -$path = $options['path'] ?? "Formularium/Datatype/" ; |
|
| 23 | -$testpath = $options['testpath'] ?? "tests/Datatype" ; |
|
| 22 | +$path = $options['path'] ?? "Formularium/Datatype/"; |
|
| 23 | +$testpath = $options['testpath'] ?? "tests/Datatype"; |
|
| 24 | 24 | |
| 25 | 25 | $code = \Formularium\Datatype::generate( |
| 26 | 26 | $datatype, |
@@ -85,9 +85,9 @@ |
||
| 85 | 85 | 'Zero width or height' |
| 86 | 86 | ); |
| 87 | 87 | } |
| 88 | - $ratio = $width/$height; |
|
| 88 | + $ratio = $width / $height; |
|
| 89 | 89 | $expected = $ratio; |
| 90 | - if (abs(($ratio-$expected)/$expected) > 0.0001) { |
|
| 90 | + if (abs(($ratio - $expected) / $expected) > 0.0001) { |
|
| 91 | 91 | throw new ValidatorException( |
| 92 | 92 | 'Image width/height ratio should be ' . $ratio |
| 93 | 93 | ); |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | 'myString' => [ |
| 53 | 53 | 'datatype' => 'string', |
| 54 | 54 | 'validators' => [ |
| 55 | - MinLength::class => [ 'value' => 3], |
|
| 56 | - MaxLength::class => [ 'value' => 30], |
|
| 55 | + MinLength::class => ['value' => 3], |
|
| 56 | + MaxLength::class => ['value' => 30], |
|
| 57 | 57 | ], |
| 58 | 58 | 'renderable' => [ |
| 59 | 59 | Renderable::LABEL => 'Type string', |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | 'myInteger' => [ |
| 68 | 68 | 'datatype' => 'integer', |
| 69 | 69 | 'validators' => [ |
| 70 | - Min::class => [ 'value' => 4], |
|
| 71 | - Max::class => [ 'value' => 40], |
|
| 70 | + Min::class => ['value' => 4], |
|
| 71 | + Max::class => ['value' => 40], |
|
| 72 | 72 | ], |
| 73 | 73 | 'renderable' => [ |
| 74 | 74 | Renderable_number::STEP => 2, |
@@ -252,7 +252,7 @@ |
||
| 252 | 252 | |
| 253 | 253 | $datatype = $codeData['datatype']; |
| 254 | 254 | $retval = []; |
| 255 | - $filename = $path . "/Datatype_{$codeData['datatypeLower']}.php"; |
|
| 255 | + $filename = $path . "/Datatype_{$codeData['datatypeLower']}.php"; |
|
| 256 | 256 | if (!file_exists($filename)) { |
| 257 | 257 | $retval['code'] = "Created {$datatype}."; |
| 258 | 258 | file_put_contents($filename, $codeData['code']); |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | |
| 136 | 136 | $name = $codeData['validator']; |
| 137 | 137 | $retval = []; |
| 138 | - $filename = $path . "/{$name}.php"; |
|
| 138 | + $filename = $path . "/{$name}.php"; |
|
| 139 | 139 | if (!file_exists($filename)) { |
| 140 | 140 | $retval['code'] = "Created validator {$name}."; |
| 141 | 141 | file_put_contents($filename, $codeData['code']); |