@@ -69,7 +69,7 @@ |
||
69 | 69 | $target = base_path('graphql/data/' . $this->lowerName . '.graphql'); |
70 | 70 | $this->writeFile( |
71 | 71 | $target, |
72 | - (bool)$this->option('overwrite'), |
|
72 | + (bool) $this->option('overwrite'), |
|
73 | 73 | $graphql |
74 | 74 | ); |
75 | 75 | $this->info('Type generated at ' . $target); |
@@ -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 |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $files = $processor->getCollection(); |
92 | 92 | if ($name && $name !== '*' && $name !== 'all') { |
93 | 93 | $files = $files->filter( |
94 | - function (GeneratedItem $g) use ($name) { |
|
94 | + function(GeneratedItem $g) use ($name) { |
|
95 | 95 | return mb_stripos($g->filename, $name); |
96 | 96 | } |
97 | 97 | ); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $this->writeFiles( |
101 | 101 | $files, |
102 | 102 | base_path(), |
103 | - (bool)$this->option('overwrite') |
|
103 | + (bool) $this->option('overwrite') |
|
104 | 104 | ); |
105 | 105 | $this->info('Finished scaffolding. You might want to run `composer dump-autoload`'); |
106 | 106 | } |
@@ -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()) |
@@ -41,19 +41,19 @@ |
||
41 | 41 | )) { |
42 | 42 | $mode = null; |
43 | 43 | switch ($matches['mode']) { |
44 | - case '11': |
|
45 | - $mode = self::RELATIONSHIP_ONE_TO_ONE; |
|
46 | - break; |
|
47 | - case '1N': |
|
48 | - $mode = self::RELATIONSHIP_ONE_TO_MANY; |
|
49 | - break; |
|
50 | - case 'NN': |
|
51 | - case 'N1': // TODO |
|
52 | - $mode = self::RELATIONSHIP_MANY_TO_MANY; |
|
53 | - break; |
|
54 | - // TODO: morph |
|
55 | - default: |
|
56 | - throw new ClassNotFoundException('Invalid relationship'); |
|
44 | + case '11': |
|
45 | + $mode = self::RELATIONSHIP_ONE_TO_ONE; |
|
46 | + break; |
|
47 | + case '1N': |
|
48 | + $mode = self::RELATIONSHIP_ONE_TO_MANY; |
|
49 | + break; |
|
50 | + case 'NN': |
|
51 | + case 'N1': // TODO |
|
52 | + $mode = self::RELATIONSHIP_MANY_TO_MANY; |
|
53 | + break; |
|
54 | + // TODO: morph |
|
55 | + default: |
|
56 | + throw new ClassNotFoundException('Invalid relationship'); |
|
57 | 57 | } |
58 | 58 | return static::factory($matches['source'], $matches['target'], $mode, (bool)$matches['inverse']); |
59 | 59 | } |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | public const RELATIONSHIP = "RELATIONSHIP"; |
17 | 17 | public const RELATIONSHIP_ONE_TO_ONE = "RELATIONSHIP_ONE_TO_ONE"; |
18 | 18 | public const RELATIONSHIP_ONE_TO_MANY = "RELATIONSHIP_ONE_TO_MANY"; |
19 | - public const RELATIONSHIP_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
19 | + public const RELATIONSHIP_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
20 | 20 | public const MORPH_ONE_TO_ONE = "RELATIONSHIP_ONE_TO_ONE"; |
21 | 21 | public const MORPH_ONE_TO_MANY = "RELATIONSHIP_ONE_TO_MANY"; |
22 | - public const MORPH_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
22 | + public const MORPH_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
23 | 23 | private function __construct() |
24 | 24 | { |
25 | 25 | // nothing |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | default: |
56 | 56 | throw new ClassNotFoundException('Invalid relationship'); |
57 | 57 | } |
58 | - return static::factory($matches['source'], $matches['target'], $mode, (bool)$matches['inverse']); |
|
58 | + return static::factory($matches['source'], $matches['target'], $mode, (bool) $matches['inverse']); |
|
59 | 59 | } |
60 | 60 | throw new ClassNotFoundException('Invalid relationship'); |
61 | 61 | } |