|
@@ -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 1 element in foreign-key list, got '.count($fkCombo)); |
|
|
523
|
+ assert(1 == count($fkCombo), 'Expected 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 1 element in related-key list, got '.count($rkCombo)); |
|
|
527
|
+ assert(1 == count($rkCombo), 'Expected 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
|
} |
|
@@ -573,10 +573,10 @@ discard block |
|
|
block discarded – undo |
|
573
|
573
|
|
|
574
|
574
|
$keyRaw = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
|
575
|
575
|
$keySegments = explode('.', $keyRaw); |
|
576
|
|
- $keyName = $keySegments[count($keySegments) - 1]; |
|
|
576
|
+ $keyName = $keySegments[count($keySegments)-1]; |
|
577
|
577
|
$localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
|
578
|
578
|
$localSegments = explode('.', $localRaw); |
|
579
|
|
- $localName = $localSegments[count($localSegments) - 1]; |
|
|
579
|
+ $localName = $localSegments[count($localSegments)-1]; |
|
580
|
580
|
$first = $keyName; |
|
581
|
581
|
$last = $localName; |
|
582
|
582
|
$this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
|
@@ -602,10 +602,10 @@ discard block |
|
|
block discarded – undo |
|
602
|
602
|
|
|
603
|
603
|
$keyName = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
|
604
|
604
|
$keySegments = explode('.', $keyName); |
|
605
|
|
- $keyName = $keySegments[count($keySegments) - 1]; |
|
|
605
|
+ $keyName = $keySegments[count($keySegments)-1]; |
|
606
|
606
|
$localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
|
607
|
607
|
$localSegments = explode('.', $localRaw); |
|
608
|
|
- $localName = $localSegments[count($localSegments) - 1]; |
|
|
608
|
+ $localName = $localSegments[count($localSegments)-1]; |
|
609
|
609
|
$first = $isBelong ? $localName : $keyName; |
|
610
|
610
|
$last = $isBelong ? $keyName : $localName; |
|
611
|
611
|
$this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
|
@@ -629,10 +629,10 @@ discard block |
|
|
block discarded – undo |
|
629
|
629
|
|
|
630
|
630
|
$keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
|
631
|
631
|
$keySegments = explode('.', $keyRaw); |
|
632
|
|
- $keyName = $keySegments[count($keySegments) - 1]; |
|
|
632
|
+ $keyName = $keySegments[count($keySegments)-1]; |
|
633
|
633
|
$localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
|
634
|
634
|
$localSegments = explode('.', $localRaw); |
|
635
|
|
- $localName = $localSegments[count($localSegments) - 1]; |
|
|
635
|
+ $localName = $localSegments[count($localSegments)-1]; |
|
636
|
636
|
$first = $isMany ? $keyName : $localName; |
|
637
|
637
|
$last = $isMany ? $localName : $keyName; |
|
638
|
638
|
$this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
|
@@ -655,10 +655,10 @@ discard block |
|
|
block discarded – undo |
|
655
|
655
|
|
|
656
|
656
|
$keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
|
657
|
657
|
$keySegments = explode('.', $keyRaw); |
|
658
|
|
- $keyName = $keySegments[count($keySegments) - 1]; |
|
|
658
|
+ $keyName = $keySegments[count($keySegments)-1]; |
|
659
|
659
|
$localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
|
660
|
660
|
$localSegments = explode('.', $localRaw); |
|
661
|
|
- $localName = $localSegments[count($localSegments) - 1]; |
|
|
661
|
+ $localName = $localSegments[count($localSegments)-1]; |
|
662
|
662
|
|
|
663
|
663
|
$first = $keyName; |
|
664
|
664
|
$last = (isset($localName) && '' != $localName) ? $localName : $foo->getRelated()->getKeyName(); |