@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | if (method_exists($this, 'getRecordOrdering')) { |
49 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
50 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
49 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
50 | + $sets['record_ordering'] = $this->getRecordOrdering($this->table); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | foreach ($sets as $set) { |
83 | 83 | $this->insertRecordSets($set); |
84 | 84 | |
85 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
86 | - $set[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
85 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
86 | + $set['record_ordering'] = $this->getRecordOrdering($this->table); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | |
122 | 122 | if (empty($where)) { |
123 | 123 | if (empty($this->primaryKeys)) { |
124 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
124 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
125 | 125 | } else { |
126 | 126 | foreach ($this->primaryKeys as $primaryKey) { |
127 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
127 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | } |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | if (method_exists($this, 'getRecordOrdering')) { |
145 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
146 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
145 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
146 | + $sets['record_ordering'] = $this->getRecordOrdering($this->table); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | return $this->db->getLastInsertId(); |
189 | 189 | } |
190 | 190 | |
191 | - return $result[ 0 ]->id; |
|
191 | + return $result[0]->id; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | protected function updateOrInsert(array $sets, array $where = []) |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | |
198 | 198 | if (empty($where)) { |
199 | 199 | if (empty($this->primaryKeys)) { |
200 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
200 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
201 | 201 | } else { |
202 | 202 | foreach ($this->primaryKeys as $primaryKey) { |
203 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
203 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
204 | 204 | } |
205 | 205 | } |
206 | 206 | } |
@@ -227,11 +227,11 @@ discard block |
||
227 | 227 | |
228 | 228 | $where = []; |
229 | 229 | if (empty($this->primaryKeys)) { |
230 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
231 | - $this->qb->where($primaryKey, $sets[ $primaryKey ]); |
|
230 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
231 | + $this->qb->where($primaryKey, $sets[$primaryKey]); |
|
232 | 232 | } else { |
233 | 233 | foreach ($this->primaryKeys as $primaryKey) { |
234 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
234 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | foreach ($sets as $set) { |
244 | 244 | $this->updateRecordSets($set); |
245 | 245 | |
246 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
247 | - $set[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
246 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
247 | + $set['record_ordering'] = $this->getRecordOrdering($this->table); |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $affectedRows = []; |
279 | 279 | |
280 | 280 | foreach ($ids as $id) { |
281 | - $affectedRows[ $id ] = $this->softDelete($id); |
|
281 | + $affectedRows[$id] = $this->softDelete($id); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | return $affectedRows; |
@@ -301,19 +301,19 @@ discard block |
||
301 | 301 | $where = []; |
302 | 302 | |
303 | 303 | if (empty($this->primaryKeys)) { |
304 | - $where[ $primaryKey ] = $id; |
|
305 | - $sets[ $primaryKey ] = $id; |
|
304 | + $where[$primaryKey] = $id; |
|
305 | + $sets[$primaryKey] = $id; |
|
306 | 306 | } elseif (is_array($id)) { |
307 | 307 | foreach ($this->primaryKeys as $primaryKey) { |
308 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
309 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
308 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
309 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
310 | 310 | } |
311 | 311 | } else { |
312 | 312 | foreach ($this->primaryKeys as $primaryKey) { |
313 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
313 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
314 | 314 | } |
315 | 315 | |
316 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
316 | + $sets[reset($this->primaryKeys)] = $id; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | // Reset Primary Keys |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $affectedRows = []; |
348 | 348 | |
349 | 349 | foreach ($ids as $id) { |
350 | - $affectedRows[ $id ] = $this->softDeleteBy($id, $where); |
|
350 | + $affectedRows[$id] = $this->softDeleteBy($id, $where); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | return $affectedRows; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $affectedRows = []; |
370 | 370 | |
371 | 371 | foreach ($ids as $id) { |
372 | - $affectedRows[ $id ] = $this->delete($id, $force); |
|
372 | + $affectedRows[$id] = $this->delete($id, $force); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | return $affectedRows; |
@@ -383,13 +383,13 @@ discard block |
||
383 | 383 | |
384 | 384 | $where = []; |
385 | 385 | if (empty($this->primaryKeys)) { |
386 | - $where[ $primaryKey ] = $id; |
|
386 | + $where[$primaryKey] = $id; |
|
387 | 387 | } elseif (is_array($id)) { |
388 | 388 | foreach ($this->primaryKeys as $primaryKey) { |
389 | - $where[ $primaryKey ] = $id[ $primaryKey ]; |
|
389 | + $where[$primaryKey] = $id[$primaryKey]; |
|
390 | 390 | } |
391 | 391 | } else { |
392 | - $where[ reset($this->primaryKeys) ] = $id; |
|
392 | + $where[reset($this->primaryKeys)] = $id; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | // Reset Primary Keys |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | $affectedRows = []; |
419 | 419 | |
420 | 420 | foreach ($ids as $id) { |
421 | - $affectedRows[ $id ] = $this->deleteBy($id, $where, $force); |
|
421 | + $affectedRows[$id] = $this->deleteBy($id, $where, $force); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | return $affectedRows; |
@@ -448,19 +448,19 @@ discard block |
||
448 | 448 | $where = []; |
449 | 449 | |
450 | 450 | if (empty($this->primaryKeys)) { |
451 | - $where[ $primaryKey ] = $id; |
|
452 | - $sets[ $primaryKey ] = $id; |
|
451 | + $where[$primaryKey] = $id; |
|
452 | + $sets[$primaryKey] = $id; |
|
453 | 453 | } elseif (is_array($id)) { |
454 | 454 | foreach ($this->primaryKeys as $primaryKey) { |
455 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
456 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
455 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
456 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
457 | 457 | } |
458 | 458 | } else { |
459 | 459 | foreach ($this->primaryKeys as $primaryKey) { |
460 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
460 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
461 | 461 | } |
462 | 462 | |
463 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
463 | + $sets[reset($this->primaryKeys)] = $id; |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | // Reset Primary Keys |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | $affectedRows = []; |
518 | 518 | |
519 | 519 | foreach ($ids as $id) { |
520 | - $affectedRows[ $id ] = $this->publish($id); |
|
520 | + $affectedRows[$id] = $this->publish($id); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | return $affectedRows; |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | $affectedRows = []; |
538 | 538 | |
539 | 539 | foreach ($ids as $id) { |
540 | - $affectedRows[ $id ] = $this->publishBy($id, $where); |
|
540 | + $affectedRows[$id] = $this->publishBy($id, $where); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | return $affectedRows; |
@@ -45,7 +45,7 @@ |
||
45 | 45 | $ormResult = new \SplFixedArray($result->count()); |
46 | 46 | |
47 | 47 | foreach ($result as $key => $row) { |
48 | - $ormResult[ $key ] = new Result\Row($row, $model); |
|
48 | + $ormResult[$key] = new Result\Row($row, $model); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | parent::__construct($ormResult->toArray()); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | $first = reset($this->storage); |
74 | - if ( ! isset($first[ $this->primaryKey ])) { |
|
74 | + if ( ! isset($first[$this->primaryKey])) { |
|
75 | 75 | $keys = $first->getKeys(); |
76 | 76 | $this->primaryKey = reset($keys); |
77 | 77 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function get($property) |
91 | 91 | { |
92 | - if (empty($get[ $property ])) { |
|
92 | + if (empty($get[$property])) { |
|
93 | 93 | if (services()->has($property)) { |
94 | 94 | return services()->get($property); |
95 | 95 | } elseif (array_key_exists($property, $this->validSubModels)) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | final protected function loadSubModel($model) |
115 | 115 | { |
116 | - if (is_file($this->validSubModels[ $model ])) { |
|
116 | + if (is_file($this->validSubModels[$model])) { |
|
117 | 117 | $className = '\\' . get_called_class() . '\\' . ucfirst($model); |
118 | 118 | $className = str_replace('\Base\\Model', '\Models', $className); |
119 | 119 |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | $args = func_get_args(); |
68 | 68 | |
69 | 69 | if (count($args)) { |
70 | - if (isset($GLOBALS[ $args[ 0 ] ])) { |
|
71 | - return $GLOBALS[ $args[ 0 ] ]; |
|
70 | + if (isset($GLOBALS[$args[0]])) { |
|
71 | + return $GLOBALS[$args[0]]; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return null; |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | $args = func_get_args(); |
94 | 94 | |
95 | 95 | if (count($args)) { |
96 | - if (isset($_ENV[ $args[ 0 ] ])) { |
|
97 | - return $_ENV[ $args[ 0 ] ]; |
|
96 | + if (isset($_ENV[$args[0]])) { |
|
97 | + return $_ENV[$args[0]]; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | return null; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $args = func_get_args(); |
196 | 196 | |
197 | 197 | if (count($args)) { |
198 | - return o2system()->models->get($args[ 0 ]); |
|
198 | + return o2system()->models->get($args[0]); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | return o2system()->models; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $args = func_get_args(); |
218 | 218 | |
219 | 219 | if (count($args)) { |
220 | - return o2system()->modules->getModule($args[ 0 ]); |
|
220 | + return o2system()->modules->getModule($args[0]); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | return o2system()->modules; |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | $args = func_get_args(); |
260 | 260 | |
261 | 261 | if (count($args)) { |
262 | - if (isset($_SESSION[ $args[ 0 ] ])) { |
|
263 | - return $_SESSION[ $args[ 0 ] ]; |
|
262 | + if (isset($_SESSION[$args[0]])) { |
|
263 | + return $_SESSION[$args[0]]; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | return null; |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | ->withQuery(''); |
27 | 27 | |
28 | 28 | if ($uriConfig = config()->offsetGet('uri')) { |
29 | - if ( ! empty($uriConfig[ 'base' ])) { |
|
29 | + if ( ! empty($uriConfig['base'])) { |
|
30 | 30 | $base = (is_https() ? 'https' : 'http') . '://' . str_replace(['http://', 'https://'], '', |
31 | - $uriConfig[ 'base' ]); |
|
31 | + $uriConfig['base']); |
|
32 | 32 | $uri = new \O2System\Kernel\Http\Message\Uri($base); |
33 | 33 | } |
34 | 34 | } |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | ->withQuery(''); |
65 | 65 | |
66 | 66 | if ($uriConfig = config()->offsetGet('uri')) { |
67 | - if ( ! empty($uriConfig[ 'base' ])) { |
|
67 | + if ( ! empty($uriConfig['base'])) { |
|
68 | 68 | $base = (is_https() ? 'https' : 'http') . '://' . str_replace(['http://', 'https://'], '', |
69 | - $uriConfig[ 'base' ]); |
|
69 | + $uriConfig['base']); |
|
70 | 70 | $uri = new \O2System\Kernel\Http\Message\Uri($base); |
71 | 71 | } |
72 | 72 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | $url = parse_url($uri); |
198 | 198 | |
199 | - if ( ! $url or ! isset($url[ 'scheme' ])) { |
|
199 | + if ( ! $url or ! isset($url['scheme'])) { |
|
200 | 200 | return (is_https() ? 'https://' : 'http://') . $uri; |
201 | 201 | } |
202 | 202 | |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | // IIS environment likely? Use 'refresh' for better compatibility |
235 | - if ($method === 'auto' && isset($_SERVER[ 'SERVER_SOFTWARE' ]) && strpos( |
|
236 | - $_SERVER[ 'SERVER_SOFTWARE' ], |
|
235 | + if ($method === 'auto' && isset($_SERVER['SERVER_SOFTWARE']) && strpos( |
|
236 | + $_SERVER['SERVER_SOFTWARE'], |
|
237 | 237 | 'Microsoft-IIS' |
238 | 238 | ) !== false |
239 | 239 | ) { |
240 | 240 | $method = 'refresh'; |
241 | 241 | } elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) { |
242 | - if (isset($_SERVER[ 'SERVER_PROTOCOL' ], $_SERVER[ 'REQUEST_METHOD' ]) && $_SERVER[ 'SERVER_PROTOCOL' ] === 'HTTP/1.1') { |
|
243 | - $code = ($_SERVER[ 'REQUEST_METHOD' ] !== 'GET') |
|
242 | + if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') { |
|
243 | + $code = ($_SERVER['REQUEST_METHOD'] !== 'GET') |
|
244 | 244 | ? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get |
245 | 245 | : 307; |
246 | 246 | } else { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $error = new ErrorException($errorMessage, $errorSeverity, $errorFile, $errorLine, $errorContext); |
134 | 134 | |
135 | 135 | // Logged the error |
136 | - if(services()->has('logger')) { |
|
136 | + if (services()->has('logger')) { |
|
137 | 137 | logger()->error( |
138 | 138 | implode( |
139 | 139 | ' ', |
@@ -284,21 +284,21 @@ discard block |
||
284 | 284 | ]; |
285 | 285 | |
286 | 286 | $this->statusCode = $code; |
287 | - $this->reasonPhrase = $error[ 'title' ]; |
|
287 | + $this->reasonPhrase = $error['title']; |
|
288 | 288 | |
289 | 289 | if (is_string($vars)) { |
290 | 290 | $vars = ['message' => $vars]; |
291 | - } elseif (is_array($vars) and empty($vars[ 'message' ])) { |
|
292 | - $vars[ 'message' ] = $error[ 'message' ]; |
|
291 | + } elseif (is_array($vars) and empty($vars['message'])) { |
|
292 | + $vars['message'] = $error['message']; |
|
293 | 293 | } |
294 | 294 | |
295 | - if (isset($vars[ 'message' ])) { |
|
296 | - $error[ 'message' ] = $vars[ 'message' ]; |
|
295 | + if (isset($vars['message'])) { |
|
296 | + $error['message'] = $vars['message']; |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | if (is_ajax() or $this->mimeType !== 'text/html') { |
300 | 300 | $this->statusCode = $code; |
301 | - $this->reasonPhrase = $error[ 'title' ]; |
|
301 | + $this->reasonPhrase = $error['title']; |
|
302 | 302 | $this->send($vars); |
303 | 303 | |
304 | 304 | exit(EXIT_ERROR); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | exit(EXIT_ERROR); |
101 | 101 | } |
102 | 102 | |
103 | - $jsonProperties[ 'name' ] = readable( |
|
103 | + $jsonProperties['name'] = readable( |
|
104 | 104 | pathinfo($modulePath, PATHINFO_FILENAME), |
105 | 105 | true |
106 | 106 | ); |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | ) . '\\'; |
114 | 114 | } else { |
115 | 115 | $namespace = $this->namespace; |
116 | - $jsonProperties[ 'namespace' ] = rtrim($namespace, '\\') . '\\'; |
|
116 | + $jsonProperties['namespace'] = rtrim($namespace, '\\') . '\\'; |
|
117 | 117 | } |
118 | 118 | |
119 | - $jsonProperties[ 'created' ] = date('d M Y'); |
|
119 | + $jsonProperties['created'] = date('d M Y'); |
|
120 | 120 | |
121 | 121 | loader()->addNamespace($namespace, $modulePath); |
122 | 122 |
@@ -38,8 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | parent::__construct('div'); |
40 | 40 | |
41 | - if (isset($attributes[ 'id' ])) { |
|
42 | - $this->entity->setEntityName($attributes[ 'id' ]); |
|
41 | + if (isset($attributes['id'])) { |
|
42 | + $this->entity->setEntityName($attributes['id']); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | if (count($attributes)) { |
@@ -38,8 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | parent::__construct('div'); |
40 | 40 | |
41 | - if (isset($attributes[ 'id' ])) { |
|
42 | - $this->entity->setEntityName($attributes[ 'id' ]); |
|
41 | + if (isset($attributes['id'])) { |
|
42 | + $this->entity->setEntityName($attributes['id']); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | if (count($attributes)) { |