Completed
Pull Request — master (#219)
by Christopher
05:48
created
src/Models/MetadataKeyMethodNamesTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     {
23 23
         switch (true) {
24 24
             case $rel instanceof BelongsTo:
25
-                $key =  $rel->{$this->checkMethodNameList($rel, ['getForeignKeyName', 'getForeignKey'])}();
25
+                $key = $rel->{$this->checkMethodNameList($rel, ['getForeignKeyName', 'getForeignKey'])}();
26 26
                 break;
27 27
             case $rel instanceof BelongsToMany:
28 28
                 $key = $rel->getForeignPivotKeyName();
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
                 $key = $rel->getForeignKeyName();
32 32
                 break;
33 33
             case $rel instanceof HasManyThrough:
34
-                $key =  $rel->getQualifiedFarKeyName();
34
+                $key = $rel->getQualifiedFarKeyName();
35 35
                 break;
36 36
             default:
37 37
                 $msg = sprintf('Unknown Relationship Type %s', get_class($rel));
Please login to merge, or discard this patch.
src/Models/MetadataRelationsTrait.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         $fileName = $method->getFileName();
90 90
 
91 91
         $file = new \SplFileObject($fileName);
92
-        $file->seek($method->getStartLine() - 1);
92
+        $file->seek($method->getStartLine()-1);
93 93
         $code = '';
94 94
         while ($file->key() < $method->getEndLine()) {
95 95
             $code .= $file->current();
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
             throw new InvalidOperationException($msg);
103 103
         }
104 104
         $begin = strpos($code, 'function(');
105
-        $code = substr($code, $begin, strrpos($code, '}') - $begin + 1);
106
-        $lastCode = $code[strlen($code) - 1];
105
+        $code = substr($code, $begin, strrpos($code, '}')-$begin+1);
106
+        $lastCode = $code[strlen($code)-1];
107 107
         if ('}' != $lastCode) {
108 108
             $msg = 'Final character of function definition must be closing brace';
109 109
             throw new InvalidOperationException($msg);
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
             foreach (static::$relTypes as $relation) {
141 141
                 //Resolve the relation's model to a Relation object.
142 142
                 if (
143
-                    !stripos($code, sprintf('$this->%s(',$relation)) ||
143
+                    !stripos($code, sprintf('$this->%s(', $relation)) ||
144 144
                     !(($relationObj = $model->$method()) instanceof Relation) ||
145 145
                     !in_array(MetadataTrait::class, class_uses($relObject = $relationObj->getRelated()))
146 146
                 ) {
147 147
                     continue;
148 148
                 }
149
-                $targObject = $biDir ? $relationObj : '\\' . get_class($relObject);;
149
+                $targObject = $biDir ? $relationObj : '\\' . get_class($relObject); ;
150 150
                 if (in_array($relation, static::$manyRelTypes)) {
151 151
                     //Collection or array of models (because Collection is Arrayable)
152 152
                     $relationships['HasMany'][$method] = $targObject;
@@ -189,8 +189,7 @@  discard block
 block discarded – undo
189 189
             $keyName = $this->polyglotFkKey($relation);
190 190
             $localName = $this->polyglotRkKey($relation);
191 191
             $thruName = $relation instanceof HasManyThrough ?
192
-                $this->polyglotThroughKey($relation) :
193
-                null;
192
+                $this->polyglotThroughKey($relation) : null;
194 193
 
195 194
             $first = $keyName;
196 195
             $last = $localName;
Please login to merge, or discard this patch.