@@ -301,17 +301,17 @@ |
||
| 301 | 301 | $lastCode = $code[strlen($code) - 1]; |
| 302 | 302 | assert('}' == $lastCode, 'Final character of function definition must be closing brace'); |
| 303 | 303 | foreach ([ |
| 304 | - 'hasMany', |
|
| 305 | - 'hasManyThrough', |
|
| 306 | - 'belongsToMany', |
|
| 307 | - 'hasOne', |
|
| 308 | - 'belongsTo', |
|
| 309 | - 'morphOne', |
|
| 310 | - 'morphTo', |
|
| 311 | - 'morphMany', |
|
| 312 | - 'morphToMany', |
|
| 313 | - 'morphedByMany' |
|
| 314 | - ] as $relation) { |
|
| 304 | + 'hasMany', |
|
| 305 | + 'hasManyThrough', |
|
| 306 | + 'belongsToMany', |
|
| 307 | + 'hasOne', |
|
| 308 | + 'belongsTo', |
|
| 309 | + 'morphOne', |
|
| 310 | + 'morphTo', |
|
| 311 | + 'morphMany', |
|
| 312 | + 'morphToMany', |
|
| 313 | + 'morphedByMany' |
|
| 314 | + ] as $relation) { |
|
| 315 | 315 | $search = '$this->' . $relation . '('; |
| 316 | 316 | if ($pos = stripos($code, $search)) { |
| 317 | 317 | //Resolve the relation's model to a Relation object. |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | $reflection = new \ReflectionMethod($model, $method); |
| 285 | 285 | |
| 286 | 286 | $file = new \SplFileObject($reflection->getFileName()); |
| 287 | - $file->seek($reflection->getStartLine() - 1); |
|
| 287 | + $file->seek($reflection->getStartLine()-1); |
|
| 288 | 288 | $code = ''; |
| 289 | 289 | while ($file->key() < $reflection->getEndLine()) { |
| 290 | 290 | $code .= $file->current(); |
@@ -297,8 +297,8 @@ discard block |
||
| 297 | 297 | 'Function definition must have keyword \'function\'' |
| 298 | 298 | ); |
| 299 | 299 | $begin = strpos($code, 'function('); |
| 300 | - $code = substr($code, $begin, strrpos($code, '}') - $begin + 1); |
|
| 301 | - $lastCode = $code[strlen($code) - 1]; |
|
| 300 | + $code = substr($code, $begin, strrpos($code, '}')-$begin+1); |
|
| 301 | + $lastCode = $code[strlen($code)-1]; |
|
| 302 | 302 | assert('}' == $lastCode, 'Final character of function definition must be closing brace'); |
| 303 | 303 | foreach ([ |
| 304 | 304 | 'hasMany', |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | break; |
| 464 | 464 | } |
| 465 | 465 | } |
| 466 | - assert(in_array($fkMethodName, $methodList), 'Selected method, '.$fkMethodName.', not in method list'); |
|
| 466 | + assert(in_array($fkMethodName, $methodList), 'Selected method, ' . $fkMethodName . ', not in method list'); |
|
| 467 | 467 | $rkMethodName = 'getQualifiedRelatedPivotKeyName'; |
| 468 | 468 | foreach ($rkList as $option) { |
| 469 | 469 | if (in_array($option, $methodList)) { |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | break; |
| 472 | 472 | } |
| 473 | 473 | } |
| 474 | - assert(in_array($rkMethodName, $methodList), 'Selected method, '.$rkMethodName.', not in method list'); |
|
| 474 | + assert(in_array($rkMethodName, $methodList), 'Selected method, ' . $rkMethodName . ', not in method list'); |
|
| 475 | 475 | $line = ['fk' => $fkMethodName, 'rk' => $rkMethodName]; |
| 476 | 476 | static::$methodPrimary[get_class($foo)] = $line; |
| 477 | 477 | } |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | break; |
| 501 | 501 | } |
| 502 | 502 | } |
| 503 | - assert(in_array($fkMethodName, $methodList), 'Selected method, '.$fkMethodName.', not in method list'); |
|
| 503 | + assert(in_array($fkMethodName, $methodList), 'Selected method, ' . $fkMethodName . ', not in method list'); |
|
| 504 | 504 | $rkMethodName = 'getQualifiedParentKeyName'; |
| 505 | 505 | foreach ($rkList as $option) { |
| 506 | 506 | if (in_array($option, $methodList)) { |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | break; |
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | - assert(in_array($rkMethodName, $methodList), 'Selected method, '.$rkMethodName.', not in method list'); |
|
| 511 | + assert(in_array($rkMethodName, $methodList), 'Selected method, ' . $rkMethodName . ', not in method list'); |
|
| 512 | 512 | $line = ['fk' => $fkMethodName, 'rk' => $rkMethodName]; |
| 513 | 513 | static::$methodAlternate[get_class($foo)] = $line; |
| 514 | 514 | } |
@@ -555,10 +555,10 @@ discard block |
||
| 555 | 555 | |
| 556 | 556 | $keyRaw = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
| 557 | 557 | $keySegments = explode('.', $keyRaw); |
| 558 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
| 558 | + $keyName = $keySegments[count($keySegments)-1]; |
|
| 559 | 559 | $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
| 560 | 560 | $localSegments = explode('.', $localRaw); |
| 561 | - $localName = $localSegments[count($localSegments) - 1]; |
|
| 561 | + $localName = $localSegments[count($localSegments)-1]; |
|
| 562 | 562 | $first = $keyName; |
| 563 | 563 | $last = $localName; |
| 564 | 564 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
@@ -584,10 +584,10 @@ discard block |
||
| 584 | 584 | |
| 585 | 585 | $keyName = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
| 586 | 586 | $keySegments = explode('.', $keyName); |
| 587 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
| 587 | + $keyName = $keySegments[count($keySegments)-1]; |
|
| 588 | 588 | $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
| 589 | 589 | $localSegments = explode('.', $localRaw); |
| 590 | - $localName = $localSegments[count($localSegments) - 1]; |
|
| 590 | + $localName = $localSegments[count($localSegments)-1]; |
|
| 591 | 591 | $first = $isBelong ? $localName : $keyName; |
| 592 | 592 | $last = $isBelong ? $keyName : $localName; |
| 593 | 593 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
@@ -611,10 +611,10 @@ discard block |
||
| 611 | 611 | |
| 612 | 612 | $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
| 613 | 613 | $keySegments = explode('.', $keyRaw); |
| 614 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
| 614 | + $keyName = $keySegments[count($keySegments)-1]; |
|
| 615 | 615 | $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
| 616 | 616 | $localSegments = explode('.', $localRaw); |
| 617 | - $localName = $localSegments[count($localSegments) - 1]; |
|
| 617 | + $localName = $localSegments[count($localSegments)-1]; |
|
| 618 | 618 | $first = $isMany ? $keyName : $localName; |
| 619 | 619 | $last = $isMany ? $localName : $keyName; |
| 620 | 620 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
@@ -637,10 +637,10 @@ discard block |
||
| 637 | 637 | |
| 638 | 638 | $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
| 639 | 639 | $keySegments = explode('.', $keyRaw); |
| 640 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
| 640 | + $keyName = $keySegments[count($keySegments)-1]; |
|
| 641 | 641 | $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
| 642 | 642 | $localSegments = explode('.', $localRaw); |
| 643 | - $localName = $localSegments[count($localSegments) - 1]; |
|
| 643 | + $localName = $localSegments[count($localSegments)-1]; |
|
| 644 | 644 | |
| 645 | 645 | $first = $keyName; |
| 646 | 646 | $last = (isset($localName) && '' != $localName) ? $localName : $foo->getRelated()->getKeyName(); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | class MetadataProvider extends MetadataBaseProvider |
| 19 | 19 | { |
| 20 | - protected $multConstraints = [ '0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; |
|
| 20 | + protected $multConstraints = ['0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; |
|
| 21 | 21 | protected static $metaNAMESPACE = 'Data'; |
| 22 | 22 | const POLYMORPHIC = 'polyMorphicPlaceholder'; |
| 23 | 23 | const POLYMORPHIC_PLURAL = 'polyMorphicPlaceholders'; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $knownKeys = array_keys($knownSide); |
| 209 | 209 | $unknownKeys = array_keys($unknownSide); |
| 210 | 210 | $dualKeys = array_intersect($knownKeys, $unknownKeys); |
| 211 | - assert(count($hooks) == (count($unknownKeys) + count($knownKeys) - count($dualKeys))); |
|
| 211 | + assert(count($hooks) == (count($unknownKeys)+count($knownKeys)-count($dualKeys))); |
|
| 212 | 212 | // if either list is empty, bail out - there's nothing to do |
| 213 | 213 | if (0 === count($knownSide) || 0 === count($unknownSide)) { |
| 214 | 214 | return []; |