Completed
Pull Request — master (#219)
by Christopher
05:44 queued 41s
created
src/Models/MetadataRelationsTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -187,14 +187,14 @@  discard block
 block discarded – undo
187 187
 
188 188
             $keyRaw = $relation->$fkMethodName();
189 189
             $keySegments = explode('.', $keyRaw);
190
-            $keyName = $keySegments[count($keySegments) - 1];
190
+            $keyName = $keySegments[count($keySegments)-1];
191 191
             $localRaw = $relation->$rkMethodName();
192 192
             $localSegments = explode('.', $localRaw);
193
-            $localName = $localSegments[count($localSegments) - 1];
193
+            $localName = $localSegments[count($localSegments)-1];
194 194
             if (null !== $thruName) {
195 195
                 $thruRaw = $relation->$thruName();
196 196
                 $thruSegments = explode('.', $thruRaw);
197
-                $thruName = $thruSegments[count($thruSegments) - 1];
197
+                $thruName = $thruSegments[count($thruSegments)-1];
198 198
             }
199 199
             $first = $keyName;
200 200
             $last = $localName;
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 
227 227
             $keyName = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate();
228 228
             $keySegments = explode('.', $keyName);
229
-            $keyName = $keySegments[count($keySegments) - 1];
229
+            $keyName = $keySegments[count($keySegments)-1];
230 230
             $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate();
231 231
             $localSegments = explode('.', $localRaw);
232
-            $localName = $localSegments[count($localSegments) - 1];
232
+            $localName = $localSegments[count($localSegments)-1];
233 233
             $first = $isBelong ? $localName : $keyName;
234 234
             $last = $isBelong ? $keyName : $localName;
235 235
             $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ);
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
 
259 259
             $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate();
260 260
             $keySegments = explode('.', $keyRaw);
261
-            $keyName = $keySegments[count($keySegments) - 1];
261
+            $keyName = $keySegments[count($keySegments)-1];
262 262
             $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate();
263 263
             $localSegments = explode('.', $localRaw);
264
-            $localName = $localSegments[count($localSegments) - 1];
264
+            $localName = $localSegments[count($localSegments)-1];
265 265
             $first = $isMany ? $keyName : $localName;
266 266
             $last = $isMany ? $localName : $keyName;
267 267
             $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ, 'unknown');
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 
290 290
             $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate();
291 291
             $keySegments = explode('.', $keyRaw);
292
-            $keyName = $keySegments[count($keySegments) - 1];
292
+            $keyName = $keySegments[count($keySegments)-1];
293 293
             $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate();
294 294
             $localSegments = explode('.', $localRaw);
295
-            $localName = $localSegments[count($localSegments) - 1];
295
+            $localName = $localSegments[count($localSegments)-1];
296 296
 
297 297
             $first = $keyName;
298 298
             $last = (isset($localName) && '' != $localName) ? $localName : $foo->getRelated()->getKeyName();
Please login to merge, or discard this patch.
src/Models/MetadataKeyMethodNamesTrait.php 2 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,16 +46,16 @@
 block discarded – undo
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'];
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
         }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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'];
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
         }
@@ -107,6 +106,6 @@  discard block
 block discarded – undo
107 106
             }
108 107
         }
109 108
         $msg = 'Expected at least 1 element in related-key list, got 0 for relation %s';
110
-        throw new InvalidOperationException(sprintf($msg,get_class($foo)));
109
+        throw new InvalidOperationException(sprintf($msg, get_class($foo)));
111 110
     }
112 111
 }
Please login to merge, or discard this patch.