@@ -184,13 +184,13 @@ discard block |
||
184 | 184 | |
185 | 185 | if (isset($config) AND is_array($config)) { |
186 | 186 | // Set default timezone |
187 | - if (isset($config[ 'datetime' ][ 'timezone' ])) { |
|
188 | - date_default_timezone_set($config[ 'datetime' ][ 'timezone' ]); |
|
187 | + if (isset($config['datetime']['timezone'])) { |
|
188 | + date_default_timezone_set($config['datetime']['timezone']); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | // Setup Language Ideom and Locale |
192 | - if (isset($config[ 'language' ])) { |
|
193 | - language()->setDefault($config[ 'language' ]); |
|
192 | + if (isset($config['language'])) { |
|
193 | + language()->setDefault($config['language']); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | config()->merge($config); |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | $packageJsonFile = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $packageJsonFile); |
421 | 421 | $packageJsonFileInfo = pathinfo($packageJsonFile); |
422 | 422 | |
423 | - if ($packageJsonFileInfo[ 'filename' ] === 'widget' or |
|
424 | - $packageJsonFileInfo[ 'filename' ] === 'language' or |
|
423 | + if ($packageJsonFileInfo['filename'] === 'widget' or |
|
424 | + $packageJsonFileInfo['filename'] === 'language' or |
|
425 | 425 | strpos($packageJsonFile, '.svn') !== false // subversion properties file conflict. |
426 | 426 | ) { |
427 | 427 | continue; |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | } |
452 | 452 | |
453 | 453 | if (strpos($packageJsonFile, |
454 | - $modularType = ucfirst(plural($packageJsonFileInfo[ 'filename' ])) . DIRECTORY_SEPARATOR) === false) { |
|
455 | - $modularType = ucfirst($packageJsonFileInfo[ 'filename' ]) . DIRECTORY_SEPARATOR; |
|
454 | + $modularType = ucfirst(plural($packageJsonFileInfo['filename'])) . DIRECTORY_SEPARATOR) === false) { |
|
455 | + $modularType = ucfirst($packageJsonFileInfo['filename']) . DIRECTORY_SEPARATOR; |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | $modularType = strtolower(rtrim($modularType, DIRECTORY_SEPARATOR)); |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | PATH_PUBLIC, |
468 | 468 | PATH_RESOURCES, |
469 | 469 | PATH_APP, |
470 | - $packageJsonFileInfo[ 'basename' ], |
|
470 | + $packageJsonFileInfo['basename'], |
|
471 | 471 | ucfirst($modularType) . DIRECTORY_SEPARATOR, |
472 | 472 | ], |
473 | 473 | '', |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | ) |
478 | 478 | ); |
479 | 479 | |
480 | - $moduleSegments = array_map(function ($string) { |
|
480 | + $moduleSegments = array_map(function($string) { |
|
481 | 481 | return dash(snakecase($string)); |
482 | 482 | }, $moduleSegments); |
483 | 483 | |
@@ -485,14 +485,14 @@ discard block |
||
485 | 485 | str_replace( |
486 | 486 | PATH_ROOT, |
487 | 487 | '', |
488 | - $packageJsonFileInfo[ 'dirname' ] |
|
488 | + $packageJsonFileInfo['dirname'] |
|
489 | 489 | ), |
490 | 490 | false |
491 | 491 | ); |
492 | 492 | |
493 | - if (isset($packageJsonMetadata[ 'namespace' ])) { |
|
494 | - $moduleNamespace = $packageJsonMetadata[ 'namespace' ]; |
|
495 | - unset($packageJsonMetadata[ 'namespace' ]); |
|
493 | + if (isset($packageJsonMetadata['namespace'])) { |
|
494 | + $moduleNamespace = $packageJsonMetadata['namespace']; |
|
495 | + unset($packageJsonMetadata['namespace']); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | $moduleParentSegments = []; |
@@ -506,16 +506,16 @@ discard block |
||
506 | 506 | $registryKey = implode('/', $moduleSegments); |
507 | 507 | |
508 | 508 | if ($registryKey === '') { |
509 | - if ($packageJsonFileInfo[ 'dirname' ] . DIRECTORY_SEPARATOR !== PATH_APP and $modularType === 'app') { |
|
509 | + if ($packageJsonFileInfo['dirname'] . DIRECTORY_SEPARATOR !== PATH_APP and $modularType === 'app') { |
|
510 | 510 | $registryKey = dash(snakecase( |
511 | - pathinfo($packageJsonFileInfo[ 'dirname' ], PATHINFO_FILENAME))); |
|
511 | + pathinfo($packageJsonFileInfo['dirname'], PATHINFO_FILENAME))); |
|
512 | 512 | } |
513 | 513 | } |
514 | 514 | |
515 | - $registry[ $registryKey ] = (new DataStructures\Module( |
|
516 | - $packageJsonFileInfo[ 'dirname' ] |
|
515 | + $registry[$registryKey] = (new DataStructures\Module( |
|
516 | + $packageJsonFileInfo['dirname'] |
|
517 | 517 | )) |
518 | - ->setType($packageJsonFileInfo[ 'filename' ]) |
|
518 | + ->setType($packageJsonFileInfo['filename']) |
|
519 | 519 | ->setNamespace($moduleNamespace) |
520 | 520 | ->setSegments($moduleSegments) |
521 | 521 | ->setParentSegments($moduleParentSegments) |
@@ -677,8 +677,8 @@ discard block |
||
677 | 677 | $segment = dash($segment); |
678 | 678 | |
679 | 679 | if ($this->exists($segment)) { |
680 | - if ($this->registry[ $segment ] instanceof DataStructures\Module) { |
|
681 | - return $this->registry[ $segment ]; |
|
680 | + if ($this->registry[$segment] instanceof DataStructures\Module) { |
|
681 | + return $this->registry[$segment]; |
|
682 | 682 | } |
683 | 683 | } |
684 | 684 | |
@@ -714,8 +714,8 @@ discard block |
||
714 | 714 | */ |
715 | 715 | public function first() |
716 | 716 | { |
717 | - if (isset($this->registry[ '' ])) { |
|
718 | - return $this->registry[ '' ]; |
|
717 | + if (isset($this->registry[''])) { |
|
718 | + return $this->registry['']; |
|
719 | 719 | } elseif (reset($this->registry)->type === 'APP') { |
720 | 720 | return reset($this->registry); |
721 | 721 | } |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | $segments = (is_array($segments) ? implode('/', array_map('dash', $segments)) : $segments); |
738 | 738 | |
739 | 739 | if ($this->exists($segments)) { |
740 | - return $this->registry[ $segments ]; |
|
740 | + return $this->registry[$segments]; |
|
741 | 741 | } |
742 | 742 | |
743 | 743 | return false; |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | |
759 | 759 | foreach ($this as $key => $module) { |
760 | 760 | if ($module instanceof DataStructures\Module) { |
761 | - $namespaces[ $key ] = new SplNamespaceInfo($module->getNamespace(), $module->getRealPath()); |
|
761 | + $namespaces[$key] = new SplNamespaceInfo($module->getNamespace(), $module->getRealPath()); |
|
762 | 762 | } |
763 | 763 | } |
764 | 764 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ]); |
86 | 86 | } |
87 | 87 | |
88 | - $update[ 'id' ] = $child->id; |
|
88 | + $update['id'] = $child->id; |
|
89 | 89 | |
90 | 90 | if ($this->hasChilds($child->id)) { |
91 | 91 | $right = $this->rebuildTree($child->id, $right, $depth + 1); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ->update($update = [ |
96 | 96 | 'record_right' => $right, |
97 | 97 | ]); |
98 | - $update[ 'id' ] = $child->id; |
|
98 | + $update['id'] = $child->id; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $i++; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public function getNumOfParents($id) |
212 | 212 | { |
213 | - if($parents = $this->getParents($id)) { |
|
213 | + if ($parents = $this->getParents($id)) { |
|
214 | 214 | return $parents->count(); |
215 | 215 | } |
216 | 216 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function getNumOfChilds($idParent, $direct = true) |
278 | 278 | { |
279 | - if($childs = $this->getChilds($idParent)) { |
|
279 | + if ($childs = $this->getChilds($idParent)) { |
|
280 | 280 | return $childs->count(); |
281 | 281 | } |
282 | 282 |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | if (method_exists($this, 'getRecordOrdering')) { |
44 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
45 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
44 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
45 | + $sets['record_ordering'] = $this->getRecordOrdering($this->table); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | if (method_exists($this, 'insertRecordSets')) { |
94 | 94 | foreach ($sets as $set) { |
95 | 95 | $this->insertRecordSets($set); |
96 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
97 | - $set[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
96 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
97 | + $set['record_ordering'] = $this->getRecordOrdering($this->table); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | } |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
155 | 155 | |
156 | 156 | if (empty($conditions)) { |
157 | - if (isset($sets[ $primaryKey ])) { |
|
158 | - $conditions = [$primaryKey => $sets[ $primaryKey ]]; |
|
157 | + if (isset($sets[$primaryKey])) { |
|
158 | + $conditions = [$primaryKey => $sets[$primaryKey]]; |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | if (method_exists($this, 'getRecordOrdering')) { |
171 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
172 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
171 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
172 | + $sets['record_ordering'] = $this->getRecordOrdering($this->table); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
203 | 203 | |
204 | 204 | if (empty($conditions)) { |
205 | - if (isset($sets[ $primaryKey ])) { |
|
206 | - $conditions = [$primaryKey => $sets[ $primaryKey ]]; |
|
205 | + if (isset($sets[$primaryKey])) { |
|
206 | + $conditions = [$primaryKey => $sets[$primaryKey]]; |
|
207 | 207 | } else { |
208 | 208 | $conditions = $sets; |
209 | 209 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | if (method_exists($this, 'updateRecordSets')) { |
237 | 237 | foreach ($sets as $key => $set) { |
238 | - $this->updateRecordSets($sets[ $key ]); |
|
238 | + $this->updateRecordSets($sets[$key]); |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | */ |
384 | 384 | private function updateRecordStatus($id, $recordStatus, $method) |
385 | 385 | { |
386 | - $sets[ 'record_status' ] = $recordStatus; |
|
386 | + $sets['record_status'] = $recordStatus; |
|
387 | 387 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
388 | 388 | |
389 | 389 | if (method_exists($this, 'updateRecordSets')) { |
@@ -417,13 +417,13 @@ discard block |
||
417 | 417 | private function updateRecordStatusMany(array $ids, $recordStatus, $method) |
418 | 418 | { |
419 | 419 | if (count($ids)) { |
420 | - $sets[ 'record_status' ] = $recordStatus; |
|
420 | + $sets['record_status'] = $recordStatus; |
|
421 | 421 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
422 | 422 | |
423 | 423 | $this->qb->whereIn($primaryKey, $ids); |
424 | 424 | |
425 | 425 | if (method_exists($this, 'updateRecordSets')) { |
426 | - $this->updateRecordSets($sets[ $key ]); |
|
426 | + $this->updateRecordSets($sets[$key]); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | if (method_exists($this, $beforeMethod = 'before' . ucfirst($method))) { |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | private function updateRecordStatusBy(array $conditions = [], $recordStatus, $method) |
456 | 456 | { |
457 | 457 | if (count($conditions)) { |
458 | - $sets[ 'record_status' ] = $recordStatus; |
|
458 | + $sets['record_status'] = $recordStatus; |
|
459 | 459 | |
460 | 460 | if (method_exists($this, 'updateRecordSets')) { |
461 | 461 | $this->updateRecordSets($sets); |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | private function updateRecordStatusManyBy($conditions = [], $recordStatus, $method) |
491 | 491 | { |
492 | 492 | if (count($conditions)) { |
493 | - $sets[ 'record_status' ] = $recordStatus; |
|
493 | + $sets['record_status'] = $recordStatus; |
|
494 | 494 | |
495 | 495 | if (method_exists($this, 'updateRecordSets')) { |
496 | 496 | $this->updateRecordSets($sets); |
@@ -99,64 +99,64 @@ discard block |
||
99 | 99 | { |
100 | 100 | $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
101 | 101 | |
102 | - if(is_null($this->recordUser)) { |
|
103 | - if(globals()->offsetExists('account')) { |
|
102 | + if (is_null($this->recordUser)) { |
|
103 | + if (globals()->offsetExists('account')) { |
|
104 | 104 | $this->setRecordUser(globals()->account->id); |
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - if ( ! isset($sets[ 'record_status' ])) { |
|
109 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
108 | + if ( ! isset($sets['record_status'])) { |
|
109 | + $sets['record_status'] = $this->recordStatus; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | if (empty($this->primaryKeys)) { |
113 | 113 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
114 | 114 | |
115 | - if (isset($sets[ $primaryKey ])) { |
|
116 | - if (empty($sets[ $primaryKey ])) { |
|
117 | - unset($sets[ $primaryKey ]); |
|
115 | + if (isset($sets[$primaryKey])) { |
|
116 | + if (empty($sets[$primaryKey])) { |
|
117 | + unset($sets[$primaryKey]); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | - if (empty($sets[ $primaryKey ])) { |
|
122 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
123 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
121 | + if (empty($sets[$primaryKey])) { |
|
122 | + if ( ! isset($sets['record_create_user'])) { |
|
123 | + $sets['record_create_user'] = $this->recordUser; |
|
124 | 124 | } |
125 | 125 | |
126 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
127 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
126 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
127 | + $sets['record_create_timestamp'] = $timestamp; |
|
128 | 128 | } elseif ($this->unixTimestamp) { |
129 | - $sets[ 'record_create_timestamp' ] = strtotime($sets[ 'record_create_timestamp' ]); |
|
129 | + $sets['record_create_timestamp'] = strtotime($sets['record_create_timestamp']); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | } else { |
133 | 133 | foreach ($this->primaryKeys as $primaryKey) { |
134 | - if (empty($sets[ $primaryKey ])) { |
|
135 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
136 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
134 | + if (empty($sets[$primaryKey])) { |
|
135 | + if ( ! isset($sets['record_create_user'])) { |
|
136 | + $sets['record_create_user'] = $this->recordUser; |
|
137 | 137 | } |
138 | 138 | |
139 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
140 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
139 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
140 | + $sets['record_create_timestamp'] = $timestamp; |
|
141 | 141 | } elseif ($this->unixTimestamp) { |
142 | - $sets[ 'record_create_timestamp' ] = strtotime($sets[ 'record_create_timestamp' ]); |
|
142 | + $sets['record_create_timestamp'] = strtotime($sets['record_create_timestamp']); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - if ( ! isset($sets[ 'record_update_user' ])) { |
|
149 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
148 | + if ( ! isset($sets['record_update_user'])) { |
|
149 | + $sets['record_update_user'] = $this->recordUser; |
|
150 | 150 | } |
151 | 151 | |
152 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
153 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
152 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
153 | + $sets['record_update_timestamp'] = $timestamp; |
|
154 | 154 | } elseif ($this->unixTimestamp) { |
155 | - $sets[ 'record_update_timestamp' ] = strtotime($sets[ 'record_update_timestamp' ]); |
|
155 | + $sets['record_update_timestamp'] = strtotime($sets['record_update_timestamp']); |
|
156 | 156 | } |
157 | 157 | |
158 | - if ( ! isset($sets[ 'record_ordering' ]) && $this->recordOrdering === true) { |
|
159 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering(); |
|
158 | + if ( ! isset($sets['record_ordering']) && $this->recordOrdering === true) { |
|
159 | + $sets['record_ordering'] = $this->getRecordOrdering(); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
@@ -169,24 +169,24 @@ discard block |
||
169 | 169 | */ |
170 | 170 | protected function updateRecordSets(array &$sets) |
171 | 171 | { |
172 | - if(is_null($this->recordUser)) { |
|
173 | - if(globals()->offsetExists('account')) { |
|
172 | + if (is_null($this->recordUser)) { |
|
173 | + if (globals()->offsetExists('account')) { |
|
174 | 174 | $this->setRecordUser(globals()->account->id); |
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | - if ( ! isset($sets[ 'record_status' ])) { |
|
179 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
178 | + if ( ! isset($sets['record_status'])) { |
|
179 | + $sets['record_status'] = $this->recordStatus; |
|
180 | 180 | } |
181 | 181 | |
182 | - if ( ! isset($sets[ 'record_update_user' ])) { |
|
183 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
182 | + if ( ! isset($sets['record_update_user'])) { |
|
183 | + $sets['record_update_user'] = $this->recordUser; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
187 | 187 | |
188 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
189 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
188 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
189 | + $sets['record_update_timestamp'] = $timestamp; |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public function getRecordOrdering() |
201 | 201 | { |
202 | - if($this->recordOrdering === true) { |
|
202 | + if ($this->recordOrdering === true) { |
|
203 | 203 | return $this->qb->countAllResults($this->table) + 1; |
204 | 204 | } |
205 | 205 |