@@ -46,7 +46,7 @@ |
||
46 | 46 | */ |
47 | 47 | public static function scalars(array $datatypes, string $ns): array |
48 | 48 | { |
49 | - $graphql = [ '# File automatically generated by Modelarium on ' . date('c') . "\n\n" ]; |
|
49 | + $graphql = ['# File automatically generated by Modelarium on ' . date('c') . "\n\n"]; |
|
50 | 50 | |
51 | 51 | foreach ($datatypes as $name) { |
52 | 52 | $typeName = Str::studly($name); |
@@ -52,8 +52,7 @@ |
||
52 | 52 | { |
53 | 53 | try { |
54 | 54 | return $this->datatype->validate($value); |
55 | - } |
|
56 | - catch (ValidatorException $e) { |
|
55 | + } catch (ValidatorException $e) { |
|
57 | 56 | throw new Error($e->getMessage()); |
58 | 57 | } |
59 | 58 | } |
@@ -45,13 +45,13 @@ |
||
45 | 45 | |
46 | 46 | Event::listen( |
47 | 47 | RegisterDirectiveNamespaces::class, |
48 | - function (RegisterDirectiveNamespaces $registerDirectiveNamespaces): string { |
|
48 | + function(RegisterDirectiveNamespaces $registerDirectiveNamespaces): string { |
|
49 | 49 | return 'Modelarium\\Laravel\\Lighthouse\\Directives'; |
50 | 50 | } |
51 | 51 | ); |
52 | 52 | Event::listen( |
53 | 53 | RegisterDirectiveNamespaces::class, |
54 | - function (RegisterDirectiveNamespaces $registerDirectiveNamespaces): string { |
|
54 | + function(RegisterDirectiveNamespaces $registerDirectiveNamespaces): string { |
|
55 | 55 | return 'App\\Datatypes\\Types'; |
56 | 56 | } |
57 | 57 | ); |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $previousResolver = $fieldValue->getResolver(); |
44 | 44 | |
45 | 45 | // Wrap around the resolver |
46 | - $wrappedResolver = function ($root, array $args, GraphQLContext $context, ResolveInfo $info) use ($previousResolver): string { |
|
46 | + $wrappedResolver = function($root, array $args, GraphQLContext $context, ResolveInfo $info) use ($previousResolver): string { |
|
47 | 47 | // Call the resolver, passing along the resolver arguments |
48 | 48 | /** @var string $result */ |
49 | 49 | $result = $previousResolver($root, $args, $context, $info); |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | // $blade = FrameworkComposer::getByName('Blade'); |
88 | 88 | |
89 | 89 | if ($vue !== null) { |
90 | - $cardFieldNames = array_map(function (Field $f) { |
|
90 | + $cardFieldNames = array_map(function(Field $f) { |
|
91 | 91 | return $f->getName(); |
92 | 92 | }, $this->cardFields); |
93 | - $tableFieldNames = array_map(function (Field $f) { |
|
93 | + $tableFieldNames = array_map(function(Field $f) { |
|
94 | 94 | return $f->getName(); |
95 | 95 | }, $this->tableFields); |
96 | 96 | |
@@ -142,12 +142,12 @@ discard block |
||
142 | 142 | protected function buildTemplateParameters(): void |
143 | 143 | { |
144 | 144 | $this->cardFields = $this->model->filterField( |
145 | - function (Field $field) { |
|
145 | + function(Field $field) { |
|
146 | 146 | return $field->getRenderable('card', false); |
147 | 147 | } |
148 | 148 | ); |
149 | 149 | $this->tableFields = $this->model->filterField( |
150 | - function (Field $field) { |
|
150 | + function(Field $field) { |
|
151 | 151 | return $field->getRenderable('table', false); |
152 | 152 | } |
153 | 153 | ); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | 'Button', |
160 | 160 | [ |
161 | 161 | Button::TYPE => 'a', |
162 | - Button::ATTRIBUTES => ['href' => "/{$this->lowerName}/edit" ], |
|
162 | + Button::ATTRIBUTES => ['href' => "/{$this->lowerName}/edit"], |
|
163 | 163 | ] |
164 | 164 | )->setContent( |
165 | 165 | '<i class="fa fa-plus"></i> Add new', |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'Table', |
203 | 203 | [ |
204 | 204 | Table::ROW_NAMES => array_map( |
205 | - function (Field $field) { |
|
205 | + function(Field $field) { |
|
206 | 206 | return $field->getRenderable(Renderable::LABEL, $field->getName()); |
207 | 207 | }, |
208 | 208 | $this->tableFields |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | true |
221 | 221 | ); |
222 | 222 | $titleFields = $this->model->filterField( |
223 | - function (Field $field) { |
|
223 | + function(Field $field) { |
|
224 | 224 | return $field->getRenderable('title', false); |
225 | 225 | } |
226 | 226 | ); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | // TODO 'hasCan' => $this->model |
246 | 246 | 'spinner' => $spinner, |
247 | 247 | 'tablelist' => $table->getRenderHTML(), |
248 | - 'tableItemFields' => array_keys(array_map(function (Field $f) { |
|
248 | + 'tableItemFields' => array_keys(array_map(function(Field $f) { |
|
249 | 249 | return $f->getName(); |
250 | 250 | }, $this->tableFields)), |
251 | 251 | 'titleField' => array_key_first($titleFields) ?: 'id' |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | if ($mode == 'editable') { |
275 | 275 | $vue->setEditableTemplate( |
276 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
276 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
277 | 277 | return $this->templateCallback($stub, $vue, $data, $m); |
278 | 278 | } |
279 | 279 | ); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | ); |
288 | 288 | } else { |
289 | 289 | $vue->setViewableTemplate( |
290 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
290 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
291 | 291 | return $this->templateCallback($stub, $vue, $data, $m); |
292 | 292 | } |
293 | 293 | ); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * card |
315 | 315 | */ |
316 | 316 | $cardFieldNames = array_map( |
317 | - function (Field $field) { |
|
317 | + function(Field $field) { |
|
318 | 318 | return $field->getName(); |
319 | 319 | }, |
320 | 320 | $this->cardFields |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * table |
351 | 351 | */ |
352 | 352 | $tableFieldNames = array_map( |
353 | - function (Field $field) { |
|
353 | + function(Field $field) { |
|
354 | 354 | return $field->getName(); |
355 | 355 | }, |
356 | 356 | $this->tableFields |
@@ -448,14 +448,14 @@ discard block |
||
448 | 448 | ]; |
449 | 449 | |
450 | 450 | $import = array_map( |
451 | - function ($i) use ($name) { |
|
451 | + function($i) use ($name) { |
|
452 | 452 | return "import {$name}$i from './{$name}$i.vue';"; |
453 | 453 | }, |
454 | 454 | $items |
455 | 455 | ); |
456 | 456 | |
457 | 457 | $export = array_map( |
458 | - function ($i) use ($name) { |
|
458 | + function($i) use ($name) { |
|
459 | 459 | return " {$name}$i,\n"; |
460 | 460 | }, |
461 | 461 | $items |
@@ -31,7 +31,7 @@ |
||
31 | 31 | /** |
32 | 32 | * @var string |
33 | 33 | */ |
34 | - protected $targetClass= ''; |
|
34 | + protected $targetClass = ''; |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * If false, $source is "User" (class with HasOne/HasMany posts()) |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | public const RELATIONSHIP = "RELATIONSHIP"; |
17 | 17 | public const RELATIONSHIP_ONE_TO_ONE = "11"; |
18 | 18 | public const RELATIONSHIP_ONE_TO_MANY = "1N"; |
19 | - public const RELATIONSHIP_MANY_TO_MANY = "NN"; |
|
19 | + public const RELATIONSHIP_MANY_TO_MANY = "NN"; |
|
20 | 20 | public const MORPH_ONE_TO_ONE = "M11"; |
21 | 21 | public const MORPH_ONE_TO_MANY = "M1N"; |
22 | - public const MORPH_MANY_TO_MANY = "MNN"; |
|
22 | + public const MORPH_MANY_TO_MANY = "MNN"; |
|
23 | 23 | |
24 | 24 | private function __construct() |
25 | 25 | { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | if (!in_array($matches['mode'], $relationships)) { |
52 | 52 | throw new ClassNotFoundException('Invalid relationship'); |
53 | 53 | } |
54 | - return static::factory($matches['source'], $matches['target'], $matches['mode'], (bool)$matches['inverse']); |
|
54 | + return static::factory($matches['source'], $matches['target'], $matches['mode'], (bool) $matches['inverse']); |
|
55 | 55 | } |
56 | 56 | throw new ClassNotFoundException('Invalid relationship'); |
57 | 57 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @var ObjectType $object |
305 | 305 | */ |
306 | 306 | |
307 | - if (str_starts_with((string)$name, '__')) { |
|
307 | + if (str_starts_with((string) $name, '__')) { |
|
308 | 308 | // internal type |
309 | 309 | continue; |
310 | 310 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | continue; |
317 | 317 | } |
318 | 318 | |
319 | - $methodName = $this->getInflector()->pluralize(mb_strtolower((string)$name)); |
|
319 | + $methodName = $this->getInflector()->pluralize(mb_strtolower((string) $name)); |
|
320 | 320 | $this->class->addMethod($methodName) |
321 | 321 | ->setReturnType('\\Illuminate\\Database\\Eloquent\\Relations\\MorphToMany') |
322 | 322 | ->setPublic() |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | if ($generateRandom) { |
342 | 342 | $this->methodRandom->addBody( |
343 | 343 | '$data["' . $lowerName . '_id"] = function () {' . "\n" . |
344 | - ' return factory(' . $targetClass . '::class)->create()->id;' . "\n" . |
|
344 | + ' return factory(' . $targetClass . '::class)->create()->id;' . "\n" . |
|
345 | 345 | '};' |
346 | 346 | ); |
347 | 347 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | function datatypes() |
10 | 10 | { |
11 | 11 | $markdown = DatatypeFactory::map( |
12 | - function (\ReflectionClass $reflection): array { |
|
12 | + function(\ReflectionClass $reflection): array { |
|
13 | 13 | $class = $reflection->getName(); |
14 | 14 | |
15 | 15 | /** |