Test Failed
Pull Request — master (#106)
by Alex
03:39
created
src/Models/MetadataTrait.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                         $reflection = new \ReflectionMethod($model, $method);
308 308
 
309 309
                         $file = new \SplFileObject($reflection->getFileName());
310
-                        $file->seek($reflection->getStartLine() - 1);
310
+                        $file->seek($reflection->getStartLine()-1);
311 311
                         $code = '';
312 312
                         while ($file->key() < $reflection->getEndLine()) {
313 313
                             $code .= $file->current();
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
                             'Function definition must have keyword \'function\''
321 321
                         );
322 322
                         $begin = strpos($code, 'function(');
323
-                        $code = substr($code, $begin, strrpos($code, '}') - $begin + 1);
324
-                        $lastCode = $code[strlen($code) - 1];
323
+                        $code = substr($code, $begin, strrpos($code, '}')-$begin+1);
324
+                        $lastCode = $code[strlen($code)-1];
325 325
                         assert('}' == $lastCode, 'Final character of function definition must be closing brace');
326 326
                         foreach ([
327 327
                                      'hasMany',
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                         break;
490 490
                     }
491 491
                 }
492
-                assert(in_array($fkMethodName, $methodList), 'Selected method, '.$fkMethodName.', not in method list');
492
+                assert(in_array($fkMethodName, $methodList), 'Selected method, ' . $fkMethodName . ', not in method list');
493 493
                 $rkMethodName = 'getQualifiedRelatedPivotKeyName';
494 494
                 foreach ($rkList as $option) {
495 495
                     if (in_array($option, $methodList)) {
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
                         break;
498 498
                     }
499 499
                 }
500
-                assert(in_array($rkMethodName, $methodList), 'Selected method, '.$rkMethodName.', not in method list');
500
+                assert(in_array($rkMethodName, $methodList), 'Selected method, ' . $rkMethodName . ', not in method list');
501 501
                 $line = ['fk' => $fkMethodName, 'rk' => $rkMethodName];
502 502
                 static::$methodPrimary[get_class($foo)] = $line;
503 503
             }
@@ -520,13 +520,13 @@  discard block
 block discarded – undo
520 520
             } else {
521 521
                 $methodList = get_class_methods(get_class($foo));
522 522
                 $fkCombo = array_values(array_intersect($fkList, $methodList));
523
-                assert(1 <= count($fkCombo), 'Expected at least 1 element in foreign-key list, got '.count($fkCombo));
523
+                assert(1 <= count($fkCombo), 'Expected at least 1 element in foreign-key list, got ' . count($fkCombo));
524 524
                 $fkMethodName = $fkCombo[0];
525
-                assert(in_array($fkMethodName, $methodList), 'Selected method, '.$fkMethodName.', not in method list');
525
+                assert(in_array($fkMethodName, $methodList), 'Selected method, ' . $fkMethodName . ', not in method list');
526 526
                 $rkCombo = array_values(array_intersect($rkList, $methodList));
527
-                assert(1 <= count($rkCombo), 'Expected at least 1 element in related-key list, got '.count($rkCombo));
527
+                assert(1 <= count($rkCombo), 'Expected at least 1 element in related-key list, got ' . count($rkCombo));
528 528
                 $rkMethodName = $rkCombo[0];
529
-                assert(in_array($rkMethodName, $methodList), 'Selected method, '.$rkMethodName.', not in method list');
529
+                assert(in_array($rkMethodName, $methodList), 'Selected method, ' . $rkMethodName . ', not in method list');
530 530
                 $line = ['fk' => $fkMethodName, 'rk' => $rkMethodName];
531 531
                 static::$methodAlternate[get_class($foo)] = $line;
532 532
             }
@@ -578,10 +578,10 @@  discard block
 block discarded – undo
578 578
 
579 579
             $keyRaw = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate();
580 580
             $keySegments = explode('.', $keyRaw);
581
-            $keyName = $keySegments[count($keySegments) - 1];
581
+            $keyName = $keySegments[count($keySegments)-1];
582 582
             $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate();
583 583
             $localSegments = explode('.', $localRaw);
584
-            $localName = $localSegments[count($localSegments) - 1];
584
+            $localName = $localSegments[count($localSegments)-1];
585 585
             $first = $keyName;
586 586
             $last = $localName;
587 587
             $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ);
@@ -607,10 +607,10 @@  discard block
 block discarded – undo
607 607
 
608 608
             $keyName = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate();
609 609
             $keySegments = explode('.', $keyName);
610
-            $keyName = $keySegments[count($keySegments) - 1];
610
+            $keyName = $keySegments[count($keySegments)-1];
611 611
             $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate();
612 612
             $localSegments = explode('.', $localRaw);
613
-            $localName = $localSegments[count($localSegments) - 1];
613
+            $localName = $localSegments[count($localSegments)-1];
614 614
             $first = $isBelong ? $localName : $keyName;
615 615
             $last = $isBelong ? $keyName : $localName;
616 616
             $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ);
@@ -634,10 +634,10 @@  discard block
 block discarded – undo
634 634
 
635 635
             $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate();
636 636
             $keySegments = explode('.', $keyRaw);
637
-            $keyName = $keySegments[count($keySegments) - 1];
637
+            $keyName = $keySegments[count($keySegments)-1];
638 638
             $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate();
639 639
             $localSegments = explode('.', $localRaw);
640
-            $localName = $localSegments[count($localSegments) - 1];
640
+            $localName = $localSegments[count($localSegments)-1];
641 641
             $first = $isMany ? $keyName : $localName;
642 642
             $last = $isMany ? $localName : $keyName;
643 643
             $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ, 'unknown');
@@ -660,10 +660,10 @@  discard block
 block discarded – undo
660 660
 
661 661
             $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate();
662 662
             $keySegments = explode('.', $keyRaw);
663
-            $keyName = $keySegments[count($keySegments) - 1];
663
+            $keyName = $keySegments[count($keySegments)-1];
664 664
             $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate();
665 665
             $localSegments = explode('.', $localRaw);
666
-            $localName = $localSegments[count($localSegments) - 1];
666
+            $localName = $localSegments[count($localSegments)-1];
667 667
 
668 668
             $first = $keyName;
669 669
             $last = (isset($localName) && '' != $localName) ? $localName : $foo->getRelated()->getKeyName();
Please login to merge, or discard this patch.
src/Models/MetadataRelationHolder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 
7 7
 class MetadataRelationHolder
8 8
 {
9
-    protected $multConstraints = [ '0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']];
9
+    protected $multConstraints = ['0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']];
10 10
     protected $relations = [];
11 11
 
12 12
     public function __construct()
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         }
27 27
         $className = get_class($model);
28 28
         if (array_key_exists($className, $this->relations)) {
29
-            $msg = $className.' already added';
29
+            $msg = $className . ' already added';
30 30
             throw new \InvalidArgumentException($msg);
31 31
         }
32 32
         $this->relations[$className] = $model->getRelationships();
Please login to merge, or discard this patch.