@@ -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); |
@@ -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 | } |
@@ -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 | /** |
@@ -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 | if (is_array($name)) { |
| 96 | 96 | throw new \Exception('Arrays not supported yet'); |
| 97 | 97 | } else { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $this->writeFiles( |
| 105 | 105 | $files, |
| 106 | 106 | base_path(), |
| 107 | - (bool)$this->option('overwrite') |
|
| 107 | + (bool) $this->option('overwrite') |
|
| 108 | 108 | ); |
| 109 | 109 | $this->info('Finished scaffolding. You might want to run `composer dump-autoload`'); |
| 110 | 110 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | return new GeneratedCollection( |
| 41 | - [ new GeneratedItem( |
|
| 41 | + [new GeneratedItem( |
|
| 42 | 42 | GeneratedItem::TYPE_SEED, |
| 43 | 43 | $this->generateString(), |
| 44 | 44 | $this->getGenerateFilename() |
@@ -101,6 +101,6 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public function getGenerateFilename(): string |
| 103 | 103 | { |
| 104 | - return $this->getBasePath('database/seeds/'. $this->studlyName . 'Seeder.php'); |
|
| 104 | + return $this->getBasePath('database/seeds/' . $this->studlyName . 'Seeder.php'); |
|
| 105 | 105 | } |
| 106 | 106 | } |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | |
| 69 | 69 | // get the title field |
| 70 | 70 | $titleField = $targetModel->firstField( |
| 71 | - function (Field $field) { |
|
| 71 | + function(Field $field) { |
|
| 72 | 72 | return $field->getRenderable('title', false); |
| 73 | 73 | } |
| 74 | 74 | ); |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | $formulariumModel = call_user_func("$model::getFormularium"); /** @phpstan-ignore-line */ |
| 57 | 57 | $graphqlQuery = $formulariumModel->mapFields( |
| 58 | - function (Field $f) { |
|
| 58 | + function(Field $f) { |
|
| 59 | 59 | return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery([self::RECURSE => false]) : null; |
| 60 | 60 | } |
| 61 | 61 | ); |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | if ($vue !== null) { |
| 121 | 121 | // build the fields for cards and tables |
| 122 | 122 | $vueCode = $vue->getVueCode(); |
| 123 | - $cardFieldNames = array_map(function (Field $f) { |
|
| 123 | + $cardFieldNames = array_map(function(Field $f) { |
|
| 124 | 124 | return $f->getName(); |
| 125 | 125 | }, $this->cardFields); |
| 126 | - $tableFieldNames = array_map(function (Field $f) { |
|
| 126 | + $tableFieldNames = array_map(function(Field $f) { |
|
| 127 | 127 | return $f->getName(); |
| 128 | 128 | }, $this->tableFields); |
| 129 | 129 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $vue, |
| 176 | 176 | 'Form', |
| 177 | 177 | 'editable', |
| 178 | - function (Field $f) { |
|
| 178 | + function(Field $f) { |
|
| 179 | 179 | if (!$f->getExtradata('modelFillable')) { |
| 180 | 180 | return false; |
| 181 | 181 | } |
@@ -245,12 +245,12 @@ discard block |
||
| 245 | 245 | $hasVue = $this->composer->getByName('Vue'); |
| 246 | 246 | |
| 247 | 247 | $this->cardFields = $this->model->filterField( |
| 248 | - function (Field $field) { |
|
| 248 | + function(Field $field) { |
|
| 249 | 249 | return $field->getRenderable('card', false); |
| 250 | 250 | } |
| 251 | 251 | ); |
| 252 | 252 | $this->tableFields = $this->model->filterField( |
| 253 | - function (Field $field) { |
|
| 253 | + function(Field $field) { |
|
| 254 | 254 | return $field->getRenderable('table', false); |
| 255 | 255 | } |
| 256 | 256 | ); |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | Button::TYPE => 'a', |
| 262 | 262 | Button::ATTRIBUTES => [ |
| 263 | 263 | 'href' => "/{$this->routeBase}/edit" |
| 264 | - ] + ($hasVue ? [ "v-if" => 'can.create' ]: []), |
|
| 264 | + ] + ($hasVue ? ["v-if" => 'can.create'] : []), |
|
| 265 | 265 | ] |
| 266 | 266 | )->setContent( |
| 267 | 267 | '<i class="fa fa-plus"></i> Add new', |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | Button::TYPE => ($hasVue ? 'router-link' : 'a'), |
| 276 | 276 | Button::ATTRIBUTES => [ |
| 277 | 277 | ':to' => "'/{$this->lowerName}/' + model.{$this->keyAttribute} + '/edit'" |
| 278 | - ] + ($hasVue ? [ "v-if" => 'can.edit' ]: []), |
|
| 278 | + ] + ($hasVue ? ["v-if" => 'can.edit'] : []), |
|
| 279 | 279 | ] |
| 280 | 280 | )->setContent( |
| 281 | 281 | '<i class="fa fa-pencil"></i> Edit', |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | Button::ATTRIBUTES => [ |
| 292 | 292 | 'href' => '#', |
| 293 | 293 | '@click.prevent' => 'remove' |
| 294 | - ] + ($hasVue ? [ "v-if" => 'can.delete' ]: []), |
|
| 294 | + ] + ($hasVue ? ["v-if" => 'can.delete'] : []), |
|
| 295 | 295 | ] |
| 296 | 296 | )->setContent( |
| 297 | 297 | '<i class="fa fa-trash"></i> Delete', |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | 'Table', |
| 307 | 307 | [ |
| 308 | 308 | Table::ROW_NAMES => array_map( |
| 309 | - function (Field $field) { |
|
| 309 | + function(Field $field) { |
|
| 310 | 310 | return $field->getRenderable(Renderable::LABEL, $field->getName()); |
| 311 | 311 | }, |
| 312 | 312 | $this->tableFields |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | true |
| 325 | 325 | ); |
| 326 | 326 | $titleFields = $this->model->filterField( |
| 327 | - function (Field $field) { |
|
| 327 | + function(Field $field) { |
|
| 328 | 328 | return $field->getRenderable('title', false); |
| 329 | 329 | } |
| 330 | 330 | ); |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | 'keyAttribute' => $this->keyAttribute, |
| 351 | 351 | 'spinner' => $spinner, |
| 352 | 352 | 'tablelist' => $table->getRenderHTML(), |
| 353 | - 'tableItemFields' => array_keys(array_map(function (Field $f) { |
|
| 353 | + 'tableItemFields' => array_keys(array_map(function(Field $f) { |
|
| 354 | 354 | return $f->getName(); |
| 355 | 355 | }, $this->tableFields)), |
| 356 | 356 | 'titleField' => array_key_first($titleFields) ?: 'id' |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | if ($mode == 'editable') { |
| 401 | 401 | $vue->setEditableTemplate( |
| 402 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 402 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 403 | 403 | return $this->templateCallback($stub, $vue, $data, $m); |
| 404 | 404 | } |
| 405 | 405 | ); |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | ); |
| 414 | 414 | } else { |
| 415 | 415 | $vue->setViewableTemplate( |
| 416 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 416 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 417 | 417 | return $this->templateCallback($stub, $vue, $data, $m); |
| 418 | 418 | } |
| 419 | 419 | ); |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | * card |
| 488 | 488 | */ |
| 489 | 489 | $cardFieldNames = array_map( |
| 490 | - function (Field $field) { |
|
| 490 | + function(Field $field) { |
|
| 491 | 491 | return $field->getName(); |
| 492 | 492 | }, |
| 493 | 493 | $this->cardFields |
@@ -500,8 +500,8 @@ discard block |
||
| 500 | 500 | $filtersQuery = ', ' . join( |
| 501 | 501 | ', ', |
| 502 | 502 | array_map( |
| 503 | - function ($item) { |
|
| 504 | - return '$' . $item['name'] . ': ' . $item['type'] . ($item['required'] ? '!' : ''); |
|
| 503 | + function($item) { |
|
| 504 | + return '$' . $item['name'] . ': ' . $item['type'] . ($item['required'] ? '!' : ''); |
|
| 505 | 505 | }, |
| 506 | 506 | $filters |
| 507 | 507 | ) |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | $filtersParams = ', ' . join( |
| 510 | 510 | ', ', |
| 511 | 511 | array_map( |
| 512 | - function ($item) { |
|
| 512 | + function($item) { |
|
| 513 | 513 | return $item['name'] . ': $' . $item['name']; |
| 514 | 514 | }, |
| 515 | 515 | $filters |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | * table |
| 549 | 549 | */ |
| 550 | 550 | $tableFieldNames = array_map( |
| 551 | - function (Field $field) { |
|
| 551 | + function(Field $field) { |
|
| 552 | 552 | return $field->getName(); |
| 553 | 553 | }, |
| 554 | 554 | $this->tableFields |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | * item |
| 585 | 585 | */ |
| 586 | 586 | $graphqlQuery = $this->model->mapFields( |
| 587 | - function (Field $f) { |
|
| 587 | + function(Field $f) { |
|
| 588 | 588 | return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery() : null; |
| 589 | 589 | } |
| 590 | 590 | ); |
@@ -661,14 +661,14 @@ discard block |
||
| 661 | 661 | ]; |
| 662 | 662 | |
| 663 | 663 | $import = array_map( |
| 664 | - function ($i) use ($name) { |
|
| 664 | + function($i) use ($name) { |
|
| 665 | 665 | return "import {$name}$i from './{$name}$i.vue';"; |
| 666 | 666 | }, |
| 667 | 667 | $items |
| 668 | 668 | ); |
| 669 | 669 | |
| 670 | 670 | $export = array_map( |
| 671 | - function ($i) use ($name) { |
|
| 671 | + function($i) use ($name) { |
|
| 672 | 672 | return " {$name}$i,\n"; |
| 673 | 673 | }, |
| 674 | 674 | $items |