Completed
Push — master ( b67d35...7e591a )
by James Ekow Abaka
02:46
created
src/DataOperations.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -237,6 +237,9 @@
 block discarded – undo
237 237
         }
238 238
     }     
239 239
     
240
+    /**
241
+     * @param string $event
242
+     */
240 243
     private function runBehaviours($event, $args)
241 244
     {
242 245
         foreach($this->wrapper->getBehaviours() as $behaviour) {
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
         }
72 72
         
73 73
         // Assign an empty array to force a validation error for empty models
74
-        if(empty($data)) {
74
+        if (empty($data)) {
75 75
             $data = [[]];
76 76
         }
77 77
 
78 78
         $this->adapter->getDriver()->beginTransaction();
79 79
 
80
-        foreach($data as $i => $datum) {
80
+        foreach ($data as $i => $datum) {
81 81
             $status = $this->saveRecord($datum, $primaryKey);
82 82
             $data[$i] = $datum;
83 83
             
84
-            if(!$status['success']) {
84
+            if (!$status['success']) {
85 85
                 $succesful = false;
86 86
                 $invalidFields[$i] = $status['invalid_fields'];
87 87
                 $this->adapter->getDriver()->rollback();
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             }
90 90
         }
91 91
         
92
-        if($succesful) {
92
+        if ($succesful) {
93 93
             //$this->assignValue($this->data, $data);
94 94
             $this->adapter->getDriver()->commit();
95 95
         } else {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         $this->wrapper->setData($record);
124 124
 
125 125
         // Run preUpdate or preSave callbacks on models and behaviours
126
-        if($pkSet) {
126
+        if ($pkSet) {
127 127
             $this->wrapper->preUpdateCallback();
128 128
             $record = $this->wrapper->getData();
129 129
             $record = reset($record) === false ? [] : reset($record);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         );
143 143
 
144 144
         // Exit if data is invalid
145
-        if($validity !== true) {
145
+        if ($validity !== true) {
146 146
             $status['invalid_fields'] = $validity;
147 147
             $status['success'] = false;
148 148
             return $status;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         $this->wrapper->setData($record);
153 153
 
154 154
         // Update or save the data and run post callbacks
155
-        if($pkSet) {
155
+        if ($pkSet) {
156 156
             $this->adapter->update($record);
157 157
             $this->wrapper->postUpdateCallback();
158 158
             $this->runBehaviours('postUpdateCallback', [$record]);
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
             }
179 179
         );
180 180
 
181
-        if(!$validator->validate($data)) {
181
+        if (!$validator->validate($data)) {
182 182
             $valid = false;
183 183
         }
184 184
 
185
-        if($valid === false) {
185
+        if ($valid === false) {
186 186
             $valid = $validator->getInvalidFields();
187 187
         }
188 188
 
@@ -192,17 +192,17 @@  discard block
 block discarded – undo
192 192
 
193 193
     private function isPrimaryKeySet($primaryKey, $data)
194 194
     {
195
-        if(is_string($primaryKey)) {
196
-            if(isset($data[$primaryKey]))
195
+        if (is_string($primaryKey)) {
196
+            if (isset($data[$primaryKey]))
197 197
             {
198 198
                 return true;
199 199
             }
200 200
         }
201
-        foreach($primaryKey as $keyField) {
202
-            if(!isset($data[$keyField])) {
201
+        foreach ($primaryKey as $keyField) {
202
+            if (!isset($data[$keyField])) {
203 203
                 break;
204 204
             }
205
-            if($data[$keyField] !== '' && $data[$keyField] !== null) {
205
+            if ($data[$keyField] !== '' && $data[$keyField] !== null) {
206 206
                 return true;
207 207
             }
208 208
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     
212 212
     private function assignValue(&$property, $value)
213 213
     {
214
-        if($this->hasMultipleData) {
214
+        if ($this->hasMultipleData) {
215 215
             $property = $value;
216 216
         } else {
217 217
             $property = $value[0];
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     
231 231
     public function isItemDeletable($primaryKey, $data)
232 232
     {
233
-        if($this->isPrimaryKeySet($primaryKey, $data)) {
233
+        if ($this->isPrimaryKeySet($primaryKey, $data)) {
234 234
             return true;
235 235
         } else {
236 236
             return false;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     
240 240
     private function runBehaviours($event, $args)
241 241
     {
242
-        foreach($this->wrapper->getBehaviours() as $behaviour) {
242
+        foreach ($this->wrapper->getBehaviours() as $behaviour) {
243 243
             $args[0] = call_user_func_array([$behaviour, $event], $args);
244 244
         }
245 245
         return $args[0];
Please login to merge, or discard this patch.
src/FilterCompiler.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -204,6 +204,10 @@
 block discarded – undo
204 204
         return $return;
205 205
     }
206 206
 
207
+    /**
208
+     * @param integer $level
209
+     * @param string $opr
210
+     */
207 211
     private function parseRightExpression($level, $opr)
208 212
     {
209 213
         switch ($opr) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             'obracket' => 'parseObracket'
196 196
         ];
197 197
 
198
-        if(isset($methods[$this->lookahead])) {
198
+        if (isset($methods[$this->lookahead])) {
199 199
             $method = $methods[$this->lookahead];
200 200
             $return = $this->$method();
201 201
         }
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
 
268 268
     public function rewriteBoundData($data) {
269 269
         $rewritten = [];
270
-        foreach($data as $key => $value) {
271
-            if(is_numeric($key))
270
+        foreach ($data as $key => $value) {
271
+            if (is_numeric($key))
272 272
             {
273 273
                 $rewritten["filter_bind_" . ($key + 1)] = $value;
274 274
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -271,8 +271,7 @@
 block discarded – undo
271 271
             if(is_numeric($key))
272 272
             {
273 273
                 $rewritten["filter_bind_" . ($key + 1)] = $value;
274
-            }
275
-            else
274
+            } else
276 275
             {
277 276
                 $rewritten[$key] = $value;
278 277
             }
Please login to merge, or discard this patch.
src/Nibii.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -45,6 +45,9 @@  discard block
 block discarded – undo
45 45
         }
46 46
     }
47 47
     
48
+    /**
49
+     * @param RecordWrapper $instance
50
+     */
48 51
     public static function getModelTable($instance)
49 52
     {
50 53
         if(self::$tableResolver) {
@@ -68,6 +71,9 @@  discard block
 block discarded – undo
68 71
         return $className;
69 72
     }
70 73
     
74
+    /**
75
+     * @param string $class
76
+     */
71 77
     public static function getModelName($class)
72 78
     {
73 79
         if(self::$modelResolver) {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     {
19 19
         $arrayed = explode('\\', $className);
20 20
         $class = array_pop($arrayed);
21
-        if($arrayed[0] == '') {
21
+        if ($arrayed[0] == '') {
22 22
             array_shift($arrayed);
23 23
         }
24 24
         return ['class' => $class, 'namespace' => implode('\\', $arrayed)];
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
     
27 27
     public static function joinModels($classA, $classB)
28 28
     {
29
-        if(self::$modelJoiner) {
29
+        if (self::$modelJoiner) {
30 30
             $modelJoiner = self::$modelJoiner;
31 31
             return $modelJoiner($classA, $classB);
32 32
         } else {
33 33
             $classA = self::getClassFileDetails($classA);
34 34
             $classB = self::getClassFileDetails($classB);
35
-            if($classA['namespace'] != $classB['namespace']) {
35
+            if ($classA['namespace'] != $classB['namespace']) {
36 36
                 throw new NibiiException(
37 37
                     "Cannot automatically join two classes of different "
38 38
                         . "namespaces. Please provide a model joiner or "
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     
48 48
     public static function getModelTable($instance)
49 49
     {
50
-        if(self::$tableResolver) {
50
+        if (self::$tableResolver) {
51 51
             $tableResolver = self::$tableResolver;
52 52
             return $tableResolver($instance);
53 53
         } else {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
     public static function getClassName($model, $context = null)
61 61
     {
62
-        if(self::$classResolver !== null && $model[0] !== "\\") {
62
+        if (self::$classResolver !== null && $model[0] !== "\\") {
63 63
             $resolver = self::$classResolver;
64 64
             $className = $resolver($model, $context);
65 65
         } else {
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     
71 71
     public static function getModelName($class)
72 72
     {
73
-        if(self::$modelResolver) {
73
+        if (self::$modelResolver) {
74 74
             $modelResolver = self::$modelResolver;
75 75
             return $modelResolver($class);
76 76
         } else {
Please login to merge, or discard this patch.
src/Operations.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -23,6 +23,10 @@
 block discarded – undo
23 23
         'save'
24 24
     ];
25 25
     
26
+    /**
27
+     * @param RecordWrapper $wrapper
28
+     * @param DriverAdapter $adapter
29
+     */
26 30
     public function __construct($wrapper, $adapter)
27 31
     {
28 32
         $this->wrapper = $wrapper;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
     private $dataOperations;
15 15
     
16 16
     private $queryOperationMethods = [
17
-        'fetch',    'fetchFirst',   'filter',   'query',    'fields', 
18
-        'cover',    'limit',        'offset',   'filterBy', 'sortBy',
19
-        'delete',   'count',        'update'
17
+        'fetch', 'fetchFirst', 'filter', 'query', 'fields', 
18
+        'cover', 'limit', 'offset', 'filterBy', 'sortBy',
19
+        'delete', 'count', 'update'
20 20
     ];
21 21
     
22 22
     private $dataOperationMethods = [
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
     {
36 36
         if (array_search($name, $this->queryOperationMethods) !== false) {
37 37
             return call_user_func_array([$this->queryOperations, "do$name"], $arguments);
38
-        } else if (array_search($name, $this->dataOperationMethods) !== false){
38
+        } else if (array_search($name, $this->dataOperationMethods) !== false) {
39 39
             return call_user_func_array([$this->dataOperations, "do$name"], $arguments);
40
-        } else if($this->queryOperations->initDynamicMethod($name)) {
40
+        } else if ($this->queryOperations->initDynamicMethod($name)) {
41 41
             return $this->queryOperations->runDynamicMethod($arguments);
42 42
         } else {
43 43
             throw new NibiiException("Method {$name} not found");
Please login to merge, or discard this patch.
src/QueryEngine.php 2 patches
Doc Comments   +18 added lines patch added patch discarded remove patch
@@ -6,11 +6,17 @@  discard block
 block discarded – undo
6 6
 
7 7
     private $db;
8 8
 
9
+    /**
10
+     * @param \ntentan\atiaa\Driver $driver
11
+     */
9 12
     public function setDriver($driver)
10 13
     {
11 14
         $this->db = $driver;
12 15
     }
13 16
     
17
+    /**
18
+     * @param string $query
19
+     */
14 20
     private function filter($query)
15 21
     {
16 22
         return $query;
@@ -34,6 +40,9 @@  discard block
 block discarded – undo
34 40
         );
35 41
     }
36 42
 
43
+    /**
44
+     * @return string
45
+     */
37 46
     public function getBulkUpdateQuery($data, $parameters)
38 47
     {
39 48
         $updateData = [];
@@ -74,6 +83,9 @@  discard block
 block discarded – undo
74 83
         );
75 84
     }
76 85
 
86
+    /**
87
+     * @return string
88
+     */
77 89
     public function getSelectQuery($parameters)
78 90
     {
79 91
         return $this->filter(sprintf(
@@ -88,6 +100,9 @@  discard block
 block discarded – undo
88 100
         );
89 101
     }
90 102
     
103
+    /**
104
+     * @return string
105
+     */
91 106
     public function getCountQuery($parameters)
92 107
     {
93 108
         return $this->filter(sprintf(
@@ -98,6 +113,9 @@  discard block
 block discarded – undo
98 113
         );
99 114
     }
100 115
 
116
+    /**
117
+     * @return string
118
+     */
101 119
     public function getDeleteQuery($parameters)
102 120
     {
103 121
         return $this->filter(sprintf(
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function getBulkUpdateQuery($data, $parameters)
38 38
     {
39 39
         $updateData = [];
40
-        foreach($data as $field => $value) {
40
+        foreach ($data as $field => $value) {
41 41
             $updateData[] = "{$this->db->quoteIdentifier($field)} = :$field";
42 42
         }
43 43
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         foreach ($fields as $field) {
61 61
             $quotedField = $this->db->quoteIdentifier($field);
62 62
 
63
-            if(array_search($field, $primaryKey) !== false) {
63
+            if (array_search($field, $primaryKey) !== false) {
64 64
                 $conditions[] = "{$quotedField} = :{$field}";
65 65
             } else {
66 66
                 $valueFields[] = "{$quotedField} = :{$field}";
Please login to merge, or discard this patch.
src/QueryParameters.php 3 patches
Doc Comments   +6 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,6 @@  discard block
 block discarded – undo
23 23
 
24 24
     /**
25 25
      *
26
-     * @param \ $model
27 26
      */
28 27
     public function __construct($wrapper)
29 28
     {
@@ -118,6 +117,9 @@  discard block
 block discarded – undo
118 117
         $this->boundData += $values;
119 118
     }
120 119
 
120
+    /**
121
+     * @param boolean $firstOnly
122
+     */
121 123
     public function setFirstOnly($firstOnly)
122 124
     {
123 125
         $this->firstOnly = $firstOnly;
@@ -139,6 +141,9 @@  discard block
 block discarded – undo
139 141
         $this->offset = $offset;
140 142
     }
141 143
     
144
+    /**
145
+     * @param string $field
146
+     */
142 147
     public function addSort($field, $direction = 'ASC')
143 148
     {
144 149
         $this->sorts[] = "$field $direction";
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,10 +92,10 @@
 block discarded – undo
92 92
         if ($numValues === 1) {
93 93
             $key = "filter_{$startIndex}";
94 94
             if($values[0] === null) {
95
-               $this->whereClause .= "{$field} is NULL";
95
+                $this->whereClause .= "{$field} is NULL";
96 96
             } else {
97
-               $this->whereClause .= "{$field} = :$key";
98
-               $this->boundData[$key] = reset($values);
97
+                $this->whereClause .= "{$field} = :$key";
98
+                $this->boundData[$key] = reset($values);
99 99
             }
100 100
         } else {
101 101
             $this->whereClause .= "{$field} IN (";
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@
 block discarded – undo
91 91
 
92 92
         if ($numValues === 1) {
93 93
             $key = "filter_{$startIndex}";
94
-            if($values[0] === null) {
94
+            if ($values[0] === null) {
95 95
                $this->whereClause .= "{$field} is NULL";
96 96
             } else {
97 97
                $this->whereClause .= "{$field} = :$key";
Please login to merge, or discard this patch.
src/RecordWrapper.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
     /**
125 125
      * @method
126
-     * @param type $name
126
+     * @param string $name
127 127
      * @param type $arguments
128 128
      * @return type
129 129
      */
@@ -157,6 +157,9 @@  discard block
 block discarded – undo
157 157
         return $this->table;
158 158
     }
159 159
     
160
+    /**
161
+     * @param integer $depth
162
+     */
160 163
     private function expandArrayValue($array, $relationships, $depth, $index = null)
161 164
     {
162 165
         foreach($relationships as $name => $relationship) {
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@
 block discarded – undo
25 25
 
26 26
 namespace ntentan\nibii;
27 27
 
28
-use ntentan\utils\Utils;
29 28
 use ntentan\kaikai\Cache;
29
+use ntentan\utils\Utils;
30 30
 
31 31
 class RecordWrapper implements \ArrayAccess, \Countable, \Iterator
32 32
 {
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
                 return Nibii::getModelTable($this);
54 54
             }
55 55
         );
56
-        foreach($this->behaviours as $behaviour) {
56
+        foreach ($this->behaviours as $behaviour) {
57 57
             $behaviourInstance = $this->loadDependency($behaviour);
58 58
             $behaviourInstance->setModel($this);
59 59
         }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     protected function getDataAdapter()
67 67
     {
68
-        if(!$this->adapter)
68
+        if (!$this->adapter)
69 69
         {
70 70
             $this->adapter = DriverAdapter::getDefaultInstance();
71 71
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     private function retrieveItem($key)
105 105
     {
106 106
         $relationships = $this->getDescription()->getRelationships();
107
-        if(isset($relationships[$key])) {
107
+        if (isset($relationships[$key])) {
108 108
             return $this->fetchRelatedFields($relationships[$key]);
109 109
         } else {
110 110
             return isset($this->modelData[$key]) ? $this->modelData[$key] : null;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     
160 160
     private function expandArrayValue($array, $relationships, $depth, $index = null)
161 161
     {
162
-        foreach($relationships as $name => $relationship) {
162
+        foreach ($relationships as $name => $relationship) {
163 163
             $array[$name] = $this->fetchRelatedFields($relationship, $index)->toArray($depth);
164 164
         }
165 165
         return $array;
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
     {
170 170
         $relationships = $this->getDescription()->getRelationships();
171 171
         $array = $this->modelData;
172
-        if($depth > 0) {
173
-            if($this->hasMultipleData()) {
174
-                foreach($array as $i => $value) {
172
+        if ($depth > 0) {
173
+            if ($this->hasMultipleData()) {
174
+                foreach ($array as $i => $value) {
175 175
                     $array[$i] = $this->expandArrayValue($value, $relationships, $depth - 1, $i);
176 176
                 }
177 177
             } else {
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
     private function hasMultipleData()
192 192
     {
193
-        if(count($this->modelData) > 0) {
193
+        if (count($this->modelData) > 0) {
194 194
             return is_numeric(array_keys($this->modelData)[0]);
195 195
         } else {
196 196
             return false;
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
     {
202 202
         $data = [];
203 203
                 
204
-        if(count($this->modelData) == 0) {
204
+        if (count($this->modelData) == 0) {
205 205
             $data = $this->modelData;
206
-        } else if($this->hasMultipleData()) {
206
+        } else if ($this->hasMultipleData()) {
207 207
             $data = $this->modelData;
208
-        } else if(count($this->modelData) > 0) {
208
+        } else if (count($this->modelData) > 0) {
209 209
             $data[] = $this->modelData;
210 210
         }
211 211
         
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     
221 221
     public function mergeData($data)
222 222
     {
223
-        foreach($data as $key => $value) {
223
+        foreach ($data as $key => $value) {
224 224
             $this->modelData[$key] = $value;
225 225
         }
226 226
         $this->dataSet = true;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
     private function wrap($offset)
255 255
     {
256
-        if(isset($this->modelData[$offset])) {
256
+        if (isset($this->modelData[$offset])) {
257 257
             $newInstance = $this->createNew();
258 258
             $newInstance->setData($this->modelData[$offset]);
259 259
             return $newInstance;
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
 
305 305
     private function fetchRelatedFields($relationship, $index = null)
306 306
     {
307
-        if($index === null) {
307
+        if ($index === null) {
308 308
             $data = $this->modelData;
309 309
         } else {
310 310
             $data = $this->modelData[$index];
311 311
         }
312 312
         $model = $relationship->getModelInstance();
313
-        if(empty($data)) {
313
+        if (empty($data)) {
314 314
             return $model;
315 315
         } else {
316 316
             return $model->fetch($relationship->getQuery($data));
Please login to merge, or discard this patch.
src/DriverAdapter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function init()
54 54
     {
55
-        if(self::$db == null) {
55
+        if (self::$db == null) {
56 56
             self::$db = \ntentan\atiaa\Driver::getConnection($this->settings);
57 57
             self::$db->setCleanDefaults(true);
58 58
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
     public function insert($record)
109 109
     {
110
-        if($this->insertQuery === null) {
110
+        if ($this->insertQuery === null) {
111 111
             $this->initInsert();
112 112
         }
113 113
         return self::$db->query($this->insertQuery, $record);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
     public function update($record)
117 117
     {
118
-        if($this->updateQuery === null) {
118
+        if ($this->updateQuery === null) {
119 119
             $this->initUpdate();
120 120
         }
121 121
         return self::$db->query($this->updateQuery, $record);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
     public static function reset()
193 193
     {
194
-        if(self::$db !== null) {
194
+        if (self::$db !== null) {
195 195
             self::$db->disconnect();
196 196
             self::$db = null;
197 197
         }
Please login to merge, or discard this patch.
src/ModelDescription.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
                 'default' => $details['default'],
29 29
                 'name' => $field
30 30
             ];
31
-            if(isset($details['default'])) {
31
+            if (isset($details['default'])) {
32 32
                 $this->fields[$field]['default'] = $details['default'];
33 33
             }
34
-            if(isset($details['length'])) {
34
+            if (isset($details['length'])) {
35 35
                 $this->fields[$field]['length'] = $details['length'];
36 36
             }
37 37
         }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $this->appendConstraints($schema['primary_key'], $this->primaryKey, true);
40 40
         $this->appendConstraints($schema['unique_keys'], $this->uniqueKeys);
41 41
 
42
-        foreach($relationships as $type => $relations) {
42
+        foreach ($relationships as $type => $relations) {
43 43
             $this->createRelationships($type, $relations);
44 44
         }
45 45
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     private function getRelationshipDetails($relationship)
63 63
     {
64
-        if(is_string($relationship))
64
+        if (is_string($relationship))
65 65
         {
66 66
             return [
67 67
                 'model' => $relationship,
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
     private function createRelationships($type, $relationships)
83 83
     {
84
-        foreach($relationships as $relationship)
84
+        foreach ($relationships as $relationship)
85 85
         {
86 86
             $relationship = $this->getRelationshipDetails($relationship);
87 87
             $class = "\\ntentan\\nibii\\relationships\\{$type}Relationship";
Please login to merge, or discard this patch.