Passed
Push — master ( 1645cc...d148de )
by Bruno
06:50
created
Modelarium/Datatypes/Datatype_relationship.php 2 patches
Switch Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@
 block discarded – undo
29 29
         if (preg_match('/^relationship:(11|1N|N1|NN):([a-zA-Z0-9]+):([a-zA-Z0-9]+)$/', $name, $matches)) {
30 30
             $mode = null;
31 31
             switch ($matches[1]) {
32
-                case '11':
33
-                    $mode = self::RELATIONSHIP_ONE_TO_ONE;
34
-                    break;
35
-                case '1N':
36
-                    $mode = self::RELATIONSHIP_ONE_TO_MANY;
37
-                    break;
38
-                case 'NN':
39
-                case 'N1': // TODO
40
-                        $mode = self::RELATIONSHIP_MANY_TO_MANY;
41
-                    break;
42
-                // TODO: morph
43
-                default:
44
-                    throw new ClassNotFoundException('Invalid relationship');
32
+            case '11':
33
+                $mode = self::RELATIONSHIP_ONE_TO_ONE;
34
+                break;
35
+            case '1N':
36
+                $mode = self::RELATIONSHIP_ONE_TO_MANY;
37
+                break;
38
+            case 'NN':
39
+            case 'N1': // TODO
40
+                    $mode = self::RELATIONSHIP_MANY_TO_MANY;
41
+                break;
42
+            // TODO: morph
43
+            default:
44
+                throw new ClassNotFoundException('Invalid relationship');
45 45
             }
46 46
             return static::factory($matches[2], $matches[3], $matches[1]); // $mode);
47 47
         }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@  discard block
 block discarded – undo
14 14
     public const RELATIONSHIP = "RELATIONSHIP";
15 15
     public const RELATIONSHIP_ONE_TO_ONE = "RELATIONSHIP_ONE_TO_ONE";
16 16
     public const RELATIONSHIP_ONE_TO_MANY = "RELATIONSHIP_ONE_TO_MANY";
17
-    public const RELATIONSHIP_MANY_TO_MANY  = "RELATIONSHIP_MANY_TO_MANY";
17
+    public const RELATIONSHIP_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY";
18 18
     public const MORPH_ONE_TO_ONE = "RELATIONSHIP_ONE_TO_ONE";
19 19
     public const MORPH_ONE_TO_MANY = "RELATIONSHIP_ONE_TO_MANY";
20
-    public const MORPH_MANY_TO_MANY  = "RELATIONSHIP_MANY_TO_MANY";
20
+    public const MORPH_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY";
21 21
 
22 22
     /**
23 23
      * @param string $name relationship:[mode]:[source]:[target]
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     /**
75 75
      * @var string
76 76
      */
77
-    protected $targetClass= '';
77
+    protected $targetClass = '';
78 78
 
79 79
     /**
80 80
      * @var string
Please login to merge, or discard this patch.
Modelarium/Laravel/Targets/ModelGenerator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
                 break;
282 282
 
283 283
             case 'morphedByMany':
284
-                $relationship = 'NN';// TODO Datatype_relationship::RELATIONSHIP_MANY_TO_MANY; // TODO
284
+                $relationship = 'NN'; // TODO Datatype_relationship::RELATIONSHIP_MANY_TO_MANY; // TODO
285 285
                 $typeMap = $this->parser->getSchema()->getTypeMap();
286 286
        
287 287
                 foreach ($typeMap as $name => $object) {
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
                      * @var ObjectType $object
294 294
                      */
295 295
 
296
-                    if (str_starts_with((string)$name, '__')) {
296
+                    if (str_starts_with((string) $name, '__')) {
297 297
                         // internal type
298 298
                         continue;
299 299
                     }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                             continue;
306 306
                         }
307 307
 
308
-                        $methodName = $this->getInflector()->pluralize(mb_strtolower((string)$name));
308
+                        $methodName = $this->getInflector()->pluralize(mb_strtolower((string) $name));
309 309
                         $this->class->addMethod($methodName)
310 310
                                 ->setPublic()
311 311
                                 ->setBody("return \$this->morphedByMany($name::class, '$lowerName');");
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         if ($generateRandom) {
329 329
             $this->methodRandom->addBody(
330 330
                 '$data["' . $lowerName . '_id"] = function () {' . "\n" .
331
-                '    return factory(' . $targetClass . '::class)->create()->id;'  . "\n" .
331
+                '    return factory(' . $targetClass . '::class)->create()->id;' . "\n" .
332 332
                 '};'
333 333
             );
334 334
         }
Please login to merge, or discard this patch.