@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | protected function getRelationsHasManyKeyNames(Relation $foo) |
27 | 27 | { |
28 | 28 | $thruName = $foo instanceof HasManyThrough ? |
29 | - $this->polyglotThroughKeyMethodNames($foo) : |
|
30 | - null; |
|
29 | + $this->polyglotThroughKeyMethodNames($foo) : null; |
|
31 | 30 | list($fkMethodName, $rkMethodName) = $this->polyglotKeyMethodNames($foo); |
32 | 31 | return [$thruName, $fkMethodName, $rkMethodName]; |
33 | 32 | } |
@@ -49,13 +48,13 @@ discard block |
||
49 | 48 | }elseif ($foo instanceof BelongsToMany) { |
50 | 49 | $fkList = ['getForeignPivotKeyName']; |
51 | 50 | $rkList = ['getRelatedPivotKeyName']; |
52 | - }elseif($foo instanceof HasOneOrMany){ |
|
51 | + }elseif ($foo instanceof HasOneOrMany) { |
|
53 | 52 | $fkList = ['getForeignKeyName']; |
54 | 53 | $rkList = ['getLocalKeyName', 'getQualifiedParentKeyName']; |
55 | - }elseif($foo instanceof HasManyThrough) { |
|
54 | + }elseif ($foo instanceof HasManyThrough) { |
|
56 | 55 | $fkList = ['getQualifiedFarKeyName']; |
57 | 56 | $rkList = ['getQualifiedParentKeyName']; |
58 | - }else{ |
|
57 | + } else { |
|
59 | 58 | $msg = sprintf('Unknown Relationship Type %s', get_class($foo)); |
60 | 59 | throw new InvalidOperationException($msg); |
61 | 60 | } |
@@ -101,8 +100,8 @@ discard block |
||
101 | 100 | } |
102 | 101 | } |
103 | 102 | |
104 | - protected function polyglotThroughKey(Relation $rel){ |
|
105 | - if(! $rel instanceof HasManyThrough){ |
|
103 | + protected function polyglotThroughKey(Relation $rel) { |
|
104 | + if (!$rel instanceof HasManyThrough) { |
|
106 | 105 | return null; |
107 | 106 | } |
108 | 107 | $segments = explode('.', $rel->{$this->checkMethodNameList($rel, ['getThroughKey', 'getQualifiedFirstKeyName'])}()); |
@@ -150,6 +149,6 @@ discard block |
||
150 | 149 | } |
151 | 150 | } |
152 | 151 | $msg = 'Expected at least 1 element in related-key list, got 0 for relation %s'; |
153 | - throw new InvalidOperationException(sprintf($msg,get_class($foo))); |
|
152 | + throw new InvalidOperationException(sprintf($msg, get_class($foo))); |
|
154 | 153 | } |
155 | 154 | } |
@@ -46,16 +46,16 @@ discard block |
||
46 | 46 | $fkList = ['getForeignKeyName', 'getForeignKey']; |
47 | 47 | // getOwnerKeyName for laravel 5.5 |
48 | 48 | $rkList = ['getOwnerKey', 'getOwnerKeyName']; |
49 | - }elseif ($foo instanceof BelongsToMany) { |
|
49 | + } elseif ($foo instanceof BelongsToMany) { |
|
50 | 50 | $fkList = ['getForeignPivotKeyName']; |
51 | 51 | $rkList = ['getRelatedPivotKeyName']; |
52 | - }elseif($foo instanceof HasOneOrMany){ |
|
52 | + } elseif($foo instanceof HasOneOrMany) { |
|
53 | 53 | $fkList = ['getForeignKeyName']; |
54 | 54 | $rkList = ['getLocalKeyName', 'getQualifiedParentKeyName']; |
55 | - }elseif($foo instanceof HasManyThrough) { |
|
55 | + } elseif($foo instanceof HasManyThrough) { |
|
56 | 56 | $fkList = ['getQualifiedFarKeyName']; |
57 | 57 | $rkList = ['getQualifiedParentKeyName']; |
58 | - }else{ |
|
58 | + } else { |
|
59 | 59 | $msg = sprintf('Unknown Relationship Type %s', get_class($foo)); |
60 | 60 | throw new InvalidOperationException($msg); |
61 | 61 | } |
@@ -101,8 +101,9 @@ discard block |
||
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - protected function polyglotThroughKey(Relation $rel){ |
|
105 | - if(! $rel instanceof HasManyThrough){ |
|
104 | + protected function polyglotThroughKey(Relation $rel) |
|
105 | + { |
|
106 | + if(! $rel instanceof HasManyThrough) { |
|
106 | 107 | return null; |
107 | 108 | } |
108 | 109 | $segments = explode('.', $rel->{$this->checkMethodNameList($rel, ['getThroughKey', 'getQualifiedFirstKeyName'])}()); |