@@ -106,7 +106,7 @@ |
||
106 | 106 | throw new Exception("Directive $validator does not have argument $argName"); |
107 | 107 | } |
108 | 108 | if ($argValidator->type === 'Int') { |
109 | - $argValue = (int)$argValue; |
|
109 | + $argValue = (int) $argValue; |
|
110 | 110 | } |
111 | 111 | $arguments[$argName] = $argValue; |
112 | 112 | } |
@@ -32,18 +32,18 @@ |
||
32 | 32 | if (preg_match('/^relationship:(M?[1N]{2}):([a-zA-Z0-9]+):([a-zA-Z0-9]+)$/', $name, $matches)) { |
33 | 33 | $mode = null; |
34 | 34 | switch ($matches[1]) { |
35 | - case '11': |
|
36 | - $mode = self::RELATIONSHIP_ONE_TO_ONE; |
|
37 | - break; |
|
38 | - case '1N': |
|
39 | - $mode = self::RELATIONSHIP_ONE_TO_MANY; |
|
40 | - break; |
|
41 | - case 'NN': |
|
42 | - $mode = self::RELATIONSHIP_MANY_TO_MANY; |
|
43 | - break; |
|
44 | - // TODO: morph |
|
45 | - default: |
|
46 | - throw new ClassNotFoundException('Invalid relationship'); |
|
35 | + case '11': |
|
36 | + $mode = self::RELATIONSHIP_ONE_TO_ONE; |
|
37 | + break; |
|
38 | + case '1N': |
|
39 | + $mode = self::RELATIONSHIP_ONE_TO_MANY; |
|
40 | + break; |
|
41 | + case 'NN': |
|
42 | + $mode = self::RELATIONSHIP_MANY_TO_MANY; |
|
43 | + break; |
|
44 | + // TODO: morph |
|
45 | + default: |
|
46 | + throw new ClassNotFoundException('Invalid relationship'); |
|
47 | 47 | } |
48 | 48 | return static::factory($matches[2], $matches[3], $matches[1]); // $mode); |
49 | 49 | } |
@@ -17,10 +17,10 @@ |
||
17 | 17 | public const RELATIONSHIP = "RELATIONSHIP"; |
18 | 18 | public const RELATIONSHIP_ONE_TO_ONE = "RELATIONSHIP_ONE_TO_ONE"; |
19 | 19 | public const RELATIONSHIP_ONE_TO_MANY = "RELATIONSHIP_ONE_TO_MANY"; |
20 | - public const RELATIONSHIP_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
20 | + public const RELATIONSHIP_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
21 | 21 | public const MORPH_ONE_TO_ONE = "RELATIONSHIP_ONE_TO_ONE"; |
22 | 22 | public const MORPH_ONE_TO_MANY = "RELATIONSHIP_ONE_TO_MANY"; |
23 | - public const MORPH_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
23 | + public const MORPH_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @param string $name relationship:[mode]:[source]:[target] |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @var ObjectType $object |
272 | 272 | */ |
273 | 273 | |
274 | - if (str_starts_with((string)$name, '__')) { |
|
274 | + if (str_starts_with((string) $name, '__')) { |
|
275 | 275 | // internal type |
276 | 276 | continue; |
277 | 277 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | continue; |
284 | 284 | } |
285 | 285 | |
286 | - $methodName = $this->getInflector()->pluralize(mb_strtolower((string)$name)); |
|
286 | + $methodName = $this->getInflector()->pluralize(mb_strtolower((string) $name)); |
|
287 | 287 | $this->class->addMethod($methodName) |
288 | 288 | ->setPublic() |
289 | 289 | ->setBody("return \$this->morphedByMany($name::class, '$lowerName');"); |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | if ($generateRandom) { |
302 | 302 | $this->methodRandom->addBody( |
303 | 303 | '$data["' . $lowerName . '_id"] = function () {' . "\n" . |
304 | - ' return factory(' . $targetClass . '::class)->create()->id;' . "\n" . |
|
304 | + ' return factory(' . $targetClass . '::class)->create()->id;' . "\n" . |
|
305 | 305 | '};' |
306 | 306 | ); |
307 | 307 | } |