@@ -307,7 +307,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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(); |
@@ -6,7 +6,7 @@ discard block |
||
| 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 |
||
| 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(); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | class MetadataProvider extends MetadataBaseProvider |
| 21 | 21 | { |
| 22 | - protected $multConstraints = [ '0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; |
|
| 22 | + protected $multConstraints = ['0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; |
|
| 23 | 23 | protected static $metaNAMESPACE = 'Data'; |
| 24 | 24 | protected static $relationCache; |
| 25 | 25 | protected static $rawRelationCache; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $knownKeys = array_keys($knownSide); |
| 218 | 218 | $unknownKeys = array_keys($unknownSide); |
| 219 | 219 | $dualKeys = array_intersect($knownKeys, $unknownKeys); |
| 220 | - assert(count($hooks) == (count($unknownKeys) + count($knownKeys) - count($dualKeys))); |
|
| 220 | + assert(count($hooks) == (count($unknownKeys)+count($knownKeys)-count($dualKeys))); |
|
| 221 | 221 | // if either list is empty, bail out - there's nothing to do |
| 222 | 222 | if (0 === count($knownSide) || 0 === count($unknownSide)) { |
| 223 | 223 | return []; |