@@ -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); |
@@ -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 | } |
@@ -54,17 +54,17 @@ |
||
| 54 | 54 | foreach ($directives as $directive) { |
| 55 | 55 | $name = $directive->name->value; |
| 56 | 56 | switch ($name) { |
| 57 | - case 'belongsToMany': |
|
| 58 | - $type1 = $this->lowerName; |
|
| 59 | - $type2 = $lowerName; |
|
| 60 | - if (strcasecmp($type1, $type2) < 0) { // TODO: check this, might not work |
|
| 61 | - $relationship = mb_strtolower($this->getInflector()->pluralize($field->name)); |
|
| 62 | - $this->extraCode[] = $this->makeManyToManySeed($type1, $type2, $relationship); |
|
| 63 | - } |
|
| 64 | - break; |
|
| 65 | - case 'morphedByMany': |
|
| 66 | - // TODO $relation = Parser::getDirectiveArgumentByName($directive, 'relation', $lowerName); |
|
| 67 | - break; |
|
| 57 | + case 'belongsToMany': |
|
| 58 | + $type1 = $this->lowerName; |
|
| 59 | + $type2 = $lowerName; |
|
| 60 | + if (strcasecmp($type1, $type2) < 0) { // TODO: check this, might not work |
|
| 61 | + $relationship = mb_strtolower($this->getInflector()->pluralize($field->name)); |
|
| 62 | + $this->extraCode[] = $this->makeManyToManySeed($type1, $type2, $relationship); |
|
| 63 | + } |
|
| 64 | + break; |
|
| 65 | + case 'morphedByMany': |
|
| 66 | + // TODO $relation = Parser::getDirectiveArgumentByName($directive, 'relation', $lowerName); |
|
| 67 | + break; |
|
| 68 | 68 | default: |
| 69 | 69 | break; |
| 70 | 70 | } |
@@ -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 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * @var ObjectType $object |
| 315 | 315 | */ |
| 316 | 316 | |
| 317 | - if (str_starts_with((string)$name, '__')) { |
|
| 317 | + if (str_starts_with((string) $name, '__')) { |
|
| 318 | 318 | // internal type |
| 319 | 319 | continue; |
| 320 | 320 | } |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | continue; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - $methodName = $this->getInflector()->pluralize(mb_strtolower((string)$name)); |
|
| 329 | + $methodName = $this->getInflector()->pluralize(mb_strtolower((string) $name)); |
|
| 330 | 330 | $this->class->addMethod($methodName) |
| 331 | 331 | ->setReturnType('\\Illuminate\\Database\\Eloquent\\Relations\\MorphToMany') |
| 332 | 332 | ->setPublic() |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | } else { |
| 355 | 355 | $this->methodRandom->addBody( |
| 356 | 356 | '$data["' . $lowerName . '_id"] = function () {' . "\n" . |
| 357 | - ' return factory(' . $targetClass . '::class)->create()->id;' . "\n" . |
|
| 357 | + ' return factory(' . $targetClass . '::class)->create()->id;' . "\n" . |
|
| 358 | 358 | '};' |
| 359 | 359 | ); |
| 360 | 360 | } |
@@ -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 | ); |