@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function __construct() |
31 | 31 | { |
32 | - if (empty($_SESSION[ 'o2system' ][ 'cart' ])) { |
|
33 | - $_SESSION[ 'o2system' ][ 'cart' ] = []; |
|
32 | + if (empty($_SESSION['o2system']['cart'])) { |
|
33 | + $_SESSION['o2system']['cart'] = []; |
|
34 | 34 | } |
35 | 35 | |
36 | - $this->storage =& $_SESSION[ 'o2system' ][ 'cart' ]; |
|
36 | + $this->storage = & $_SESSION['o2system']['cart']; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // ------------------------------------------------------------------------ |
@@ -56,29 +56,29 @@ discard block |
||
56 | 56 | ], $item); |
57 | 57 | |
58 | 58 | // set sku |
59 | - $sku = empty($item[ 'sku' ]) ? $item[ 'id' ] : $item[ 'sku' ]; |
|
59 | + $sku = empty($item['sku']) ? $item['id'] : $item['sku']; |
|
60 | 60 | |
61 | 61 | // set sub-total |
62 | - $item[ 'subTotal' ][ 'price' ] = $item[ 'price' ] * $item[ 'quantity' ]; |
|
63 | - $item[ 'subTotal' ][ 'discount' ] = 0; |
|
62 | + $item['subTotal']['price'] = $item['price'] * $item['quantity']; |
|
63 | + $item['subTotal']['discount'] = 0; |
|
64 | 64 | |
65 | - if (is_numeric($item[ 'discount' ])) { |
|
66 | - $item[ 'subTotal' ][ 'discount' ] = $item[ 'subTotal' ][ 'price' ] - $item[ 'discount' ]; |
|
67 | - } elseif (is_string($item[ 'discount' ]) && strpos($item[ 'discount' ], '+') !== false) { |
|
68 | - $discounts = explode('+', $item[ 'discount' ]); |
|
65 | + if (is_numeric($item['discount'])) { |
|
66 | + $item['subTotal']['discount'] = $item['subTotal']['price'] - $item['discount']; |
|
67 | + } elseif (is_string($item['discount']) && strpos($item['discount'], '+') !== false) { |
|
68 | + $discounts = explode('+', $item['discount']); |
|
69 | 69 | if (count($discounts)) { |
70 | - $item[ 'subTotal' ][ 'discount' ] = $item[ 'subTotal' ][ 'price' ] * (intval(reset($discounts)) / 100); |
|
70 | + $item['subTotal']['discount'] = $item['subTotal']['price'] * (intval(reset($discounts)) / 100); |
|
71 | 71 | foreach (array_slice($discounts, 1) as $discount) { |
72 | - $item[ 'subTotal' ][ 'discount' ] += $item[ 'subTotal' ][ 'discount' ] * (intval($discount) / 100); |
|
72 | + $item['subTotal']['discount'] += $item['subTotal']['discount'] * (intval($discount) / 100); |
|
73 | 73 | } |
74 | 74 | } |
75 | - } elseif (is_string($item[ 'discount' ]) && strpos($item[ 'discount' ], '%') !== false) { |
|
76 | - $item[ 'subTotal' ][ 'discount' ] = $item[ 'subTotal' ][ 'price' ] * (intval($item[ 'discount' ]) / 100); |
|
75 | + } elseif (is_string($item['discount']) && strpos($item['discount'], '%') !== false) { |
|
76 | + $item['subTotal']['discount'] = $item['subTotal']['price'] * (intval($item['discount']) / 100); |
|
77 | 77 | } |
78 | 78 | |
79 | - $item[ 'subTotal' ][ 'weight' ] = $item[ 'weight' ] * $item[ 'quantity' ]; |
|
79 | + $item['subTotal']['weight'] = $item['weight'] * $item['quantity']; |
|
80 | 80 | |
81 | - $this->storage[ $sku ] = $item; |
|
81 | + $this->storage[$sku] = $item; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // ------------------------------------------------------------------------ |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | $item = array_merge($this->offsetGet($sku), $item); |
98 | 98 | |
99 | 99 | // update sub-total |
100 | - $item[ 'subTotal' ][ 'price' ] = $item[ 'price' ] * $item[ 'quantity' ]; |
|
101 | - $item[ 'subTotal' ][ 'weight' ] = $item[ 'weight' ] * $item[ 'quantity' ]; |
|
100 | + $item['subTotal']['price'] = $item['price'] * $item['quantity']; |
|
101 | + $item['subTotal']['weight'] = $item['weight'] * $item['quantity']; |
|
102 | 102 | |
103 | - $this->storage[ $sku ] = $item; |
|
103 | + $this->storage[$sku] = $item; |
|
104 | 104 | |
105 | 105 | return true; |
106 | 106 | } |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | |
122 | 122 | if ($this->count()) { |
123 | 123 | foreach ($this->storage as $id => $item) { |
124 | - if (isset($item[ 'subTotal' ][ 'weight' ])) { |
|
125 | - $totalWeight += (int)$item[ 'weight' ]; |
|
124 | + if (isset($item['subTotal']['weight'])) { |
|
125 | + $totalWeight += (int)$item['weight']; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | |
144 | 144 | if ($this->count()) { |
145 | 145 | foreach ($this->storage as $id => $item) { |
146 | - if (isset($item[ 'subTotal' ][ 'price' ])) { |
|
147 | - $totalPrice += (int)$item[ 'price' ]; |
|
146 | + if (isset($item['subTotal']['price'])) { |
|
147 | + $totalPrice += (int)$item['price']; |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function destroy() |
161 | 161 | { |
162 | - unset($_SESSION[ 'o2system' ][ 'cart' ]); |
|
162 | + unset($_SESSION['o2system']['cart']); |
|
163 | 163 | parent::destroy(); |
164 | 164 | } |
165 | 165 | } |
166 | 166 | \ No newline at end of file |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $packageJsonFile = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $packageJsonFile); |
104 | 104 | $packageJsonFileInfo = pathinfo($packageJsonFile); |
105 | 105 | |
106 | - if ($packageJsonFileInfo[ 'filename' ] === 'language') { |
|
106 | + if ($packageJsonFileInfo['filename'] === 'language') { |
|
107 | 107 | if (is_cli()) { |
108 | 108 | output()->verbose( |
109 | 109 | (new Format()) |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | ); |
127 | 127 | } |
128 | 128 | |
129 | - $registry[ $package->getDirName() ] = $package; |
|
129 | + $registry[$package->getDirName()] = $package; |
|
130 | 130 | } elseif (is_cli()) { |
131 | 131 | output()->verbose( |
132 | 132 | (new Format()) |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | if (isset($package)) { |
172 | 172 | if ($this->registered($package)) { |
173 | - return $this->registry[ $package ]; |
|
173 | + return $this->registry[$package]; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | return false; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function registered($package) |
192 | 192 | { |
193 | - return isset($this->registry[ $package ]); |
|
193 | + return isset($this->registry[$package]); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | // ------------------------------------------------------------------------ |
@@ -144,20 +144,20 @@ discard block |
||
144 | 144 | |
145 | 145 | if (is_dir($baseDirectory)) { |
146 | 146 | // initialize the namespace prefix array |
147 | - if (isset($this->namespaceDirs[ $namespace ]) === false) { |
|
148 | - $this->namespaceDirs[ $namespace ] = []; |
|
147 | + if (isset($this->namespaceDirs[$namespace]) === false) { |
|
148 | + $this->namespaceDirs[$namespace] = []; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // retain the base directory for the namespace prefix |
152 | - if ( ! in_array($baseDirectory, $this->namespaceDirs[ $namespace ])) { |
|
152 | + if ( ! in_array($baseDirectory, $this->namespaceDirs[$namespace])) { |
|
153 | 153 | if ($prepend) { |
154 | - array_unshift($this->namespaceDirs[ $namespace ], $baseDirectory); |
|
154 | + array_unshift($this->namespaceDirs[$namespace], $baseDirectory); |
|
155 | 155 | } else { |
156 | - array_push($this->namespaceDirs[ $namespace ], $baseDirectory); |
|
156 | + array_push($this->namespaceDirs[$namespace], $baseDirectory); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - $this->namespaceDirsMap[ $baseDirectory ] = $namespace; |
|
160 | + $this->namespaceDirsMap[$baseDirectory] = $namespace; |
|
161 | 161 | |
162 | 162 | // Register Namespace Language |
163 | 163 | language()->addFilePath($baseDirectory); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | if (is_dir($publicDir) and ! in_array($publicDir, $this->publicDirs)) { |
198 | 198 | if (isset($offset)) { |
199 | - $this->publicDirs[ $offset ] = $publicDir; |
|
199 | + $this->publicDirs[$offset] = $publicDir; |
|
200 | 200 | } else { |
201 | 201 | $this->publicDirs[] = $publicDir; |
202 | 202 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | |
223 | 223 | if (is_dir($resourcesDir) and ! in_array($resourcesDir, $this->resourcesDirs)) { |
224 | 224 | if (isset($offset)) { |
225 | - $this->resourcesDirs[ $offset ] = $resourcesDir; |
|
225 | + $this->resourcesDirs[$offset] = $resourcesDir; |
|
226 | 226 | } else { |
227 | 227 | $this->resourcesDirs[] = $resourcesDir; |
228 | 228 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $dir = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
283 | 283 | |
284 | 284 | if (array_key_exists($dir, $this->namespaceDirsMap)) { |
285 | - return $this->namespaceDirsMap[ $dir ]; |
|
285 | + return $this->namespaceDirsMap[$dir]; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | return false; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $namespace = trim($namespace, '\\') . '\\'; |
328 | 328 | |
329 | 329 | if (array_key_exists($namespace, $this->namespaceDirs)) { |
330 | - return $this->namespaceDirs[ $namespace ]; |
|
330 | + return $this->namespaceDirs[$namespace]; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | return false; |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | if (false !== ($modules = modules()->getRegistry())) { |
349 | 349 | foreach ($modules as $module) { |
350 | 350 | if ($module instanceof Module) { |
351 | - if (empty($this->namespaceDirs[ $module->getNamespace() ])) { |
|
351 | + if (empty($this->namespaceDirs[$module->getNamespace()])) { |
|
352 | 352 | $this->addNamespace($module->getNamespace(), $module->getRealPath()); |
353 | 353 | } |
354 | 354 | } |
@@ -416,12 +416,12 @@ discard block |
||
416 | 416 | public function loadMappedFile($namespace, $relativeClass) |
417 | 417 | { |
418 | 418 | // are there any base directories for this namespace prefix? |
419 | - if (isset($this->namespaceDirs[ $namespace ]) === false) { |
|
419 | + if (isset($this->namespaceDirs[$namespace]) === false) { |
|
420 | 420 | return false; |
421 | 421 | } |
422 | 422 | |
423 | 423 | // look through base directories for this namespace prefix |
424 | - foreach ($this->namespaceDirs[ $namespace ] as $namespaceDirectory) { |
|
424 | + foreach ($this->namespaceDirs[$namespace] as $namespaceDirectory) { |
|
425 | 425 | |
426 | 426 | // replace the namespace prefix with the base directory, |
427 | 427 | // replace namespace separators with directory separators |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | } |
505 | 505 | |
506 | 506 | if ($this->requireFile($helper)) { |
507 | - $this->loadedHelpers[ pathinfo($helper, PATHINFO_FILENAME) ][] = $helper; |
|
507 | + $this->loadedHelpers[pathinfo($helper, PATHINFO_FILENAME)][] = $helper; |
|
508 | 508 | |
509 | 509 | return; |
510 | 510 | } |
@@ -520,17 +520,17 @@ discard block |
||
520 | 520 | } |
521 | 521 | |
522 | 522 | if ( ! array_key_exists($helper, $this->loadedHelpers)) { |
523 | - $this->loadedHelpers[ $helper ] = []; |
|
523 | + $this->loadedHelpers[$helper] = []; |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | foreach ($helperDirectories as $helperDirectory) { |
527 | 527 | |
528 | 528 | $helperFilePath = $helperDirectory . studlycase($helper) . '.php'; |
529 | 529 | |
530 | - if (in_array($helperFilePath, $this->loadedHelpers[ $helper ])) { |
|
530 | + if (in_array($helperFilePath, $this->loadedHelpers[$helper])) { |
|
531 | 531 | continue; |
532 | 532 | } elseif ($this->requireFile($helperFilePath)) { |
533 | - $this->loadedHelpers[ $helper ][] = $helperFilePath; |
|
533 | + $this->loadedHelpers[$helper][] = $helperFilePath; |
|
534 | 534 | } |
535 | 535 | } |
536 | 536 | } |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | |
78 | 78 | if (empty($where)) { |
79 | 79 | if (empty($this->primaryKeys)) { |
80 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
80 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
81 | 81 | } else { |
82 | 82 | foreach ($this->primaryKeys as $primaryKey) { |
83 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
83 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | } |
@@ -153,11 +153,11 @@ discard block |
||
153 | 153 | |
154 | 154 | $where = []; |
155 | 155 | if (empty($this->primaryKeys)) { |
156 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
157 | - $this->qb->where($primaryKey, $sets[ $primaryKey ]); |
|
156 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
157 | + $this->qb->where($primaryKey, $sets[$primaryKey]); |
|
158 | 158 | } else { |
159 | 159 | foreach ($this->primaryKeys as $primaryKey) { |
160 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
160 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $affectedRows = []; |
201 | 201 | |
202 | 202 | foreach ($ids as $id) { |
203 | - $affectedRows[ $id ] = $this->trash($id); |
|
203 | + $affectedRows[$id] = $this->trash($id); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | return $affectedRows; |
@@ -225,19 +225,19 @@ discard block |
||
225 | 225 | $where = []; |
226 | 226 | |
227 | 227 | if (empty($this->primaryKeys)) { |
228 | - $where[ $primaryKey ] = $id; |
|
229 | - $sets[ $primaryKey ] = $id; |
|
228 | + $where[$primaryKey] = $id; |
|
229 | + $sets[$primaryKey] = $id; |
|
230 | 230 | } elseif (is_array($id)) { |
231 | 231 | foreach ($this->primaryKeys as $primaryKey) { |
232 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
233 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
232 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
233 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
234 | 234 | } |
235 | 235 | } else { |
236 | 236 | foreach ($this->primaryKeys as $primaryKey) { |
237 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
237 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
238 | 238 | } |
239 | 239 | |
240 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
240 | + $sets[reset($this->primaryKeys)] = $id; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | // Reset Primary Keys |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $affectedRows = []; |
278 | 278 | |
279 | 279 | foreach ($ids as $id) { |
280 | - $affectedRows[ $id ] = $this->trashBy($id, $where, $collection); |
|
280 | + $affectedRows[$id] = $this->trashBy($id, $where, $collection); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | return $affectedRows; |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $affectedRows = []; |
312 | 312 | |
313 | 313 | foreach ($ids as $id) { |
314 | - $affectedRows[ $id ] = $this->delete($id, $force, $collection); |
|
314 | + $affectedRows[$id] = $this->delete($id, $force, $collection); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | return $affectedRows; |
@@ -335,13 +335,13 @@ discard block |
||
335 | 335 | |
336 | 336 | $where = []; |
337 | 337 | if (empty($this->primaryKeys)) { |
338 | - $where[ $primaryKey ] = $id; |
|
338 | + $where[$primaryKey] = $id; |
|
339 | 339 | } elseif (is_array($id)) { |
340 | 340 | foreach ($this->primaryKeys as $primaryKey) { |
341 | - $where[ $primaryKey ] = $id[ $primaryKey ]; |
|
341 | + $where[$primaryKey] = $id[$primaryKey]; |
|
342 | 342 | } |
343 | 343 | } else { |
344 | - $where[ reset($this->primaryKeys) ] = $id; |
|
344 | + $where[reset($this->primaryKeys)] = $id; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | // Reset Primary Keys |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | $affectedRows = []; |
378 | 378 | |
379 | 379 | foreach ($ids as $id) { |
380 | - $affectedRows[ $id ] = $this->deleteBy($id, $where, $force, $collection); |
|
380 | + $affectedRows[$id] = $this->deleteBy($id, $where, $force, $collection); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | return $affectedRows; |
@@ -425,19 +425,19 @@ discard block |
||
425 | 425 | $where = []; |
426 | 426 | |
427 | 427 | if (empty($this->primaryKeys)) { |
428 | - $where[ $primaryKey ] = $id; |
|
429 | - $sets[ $primaryKey ] = $id; |
|
428 | + $where[$primaryKey] = $id; |
|
429 | + $sets[$primaryKey] = $id; |
|
430 | 430 | } elseif (is_array($id)) { |
431 | 431 | foreach ($this->primaryKeys as $primaryKey) { |
432 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
433 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
432 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
433 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
434 | 434 | } |
435 | 435 | } else { |
436 | 436 | foreach ($this->primaryKeys as $primaryKey) { |
437 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
437 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
438 | 438 | } |
439 | 439 | |
440 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
440 | + $sets[reset($this->primaryKeys)] = $id; |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | // Reset Primary Keys |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | $affectedRows = []; |
517 | 517 | |
518 | 518 | foreach ($ids as $id) { |
519 | - $affectedRows[ $id ] = $this->publish($id, $collection); |
|
519 | + $affectedRows[$id] = $this->publish($id, $collection); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | return $affectedRows; |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | $affectedRows = []; |
549 | 549 | |
550 | 550 | foreach ($ids as $id) { |
551 | - $affectedRows[ $id ] = $this->publishBy($id, $where, $collection); |
|
551 | + $affectedRows[$id] = $this->publishBy($id, $where, $collection); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | return $affectedRows; |
@@ -95,40 +95,40 @@ discard block |
||
95 | 95 | |
96 | 96 | $timestamp = $this->isUnixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
97 | 97 | |
98 | - if ( ! isset($sets[ 'record_status' ])) { |
|
99 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
98 | + if ( ! isset($sets['record_status'])) { |
|
99 | + $sets['record_status'] = $this->recordStatus; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | if (empty($this->primary_keys)) { |
103 | 103 | $primary_key = isset($this->primary_key) ? $this->primary_key : 'id'; |
104 | 104 | |
105 | - if (empty($sets[ $primary_key ])) { |
|
106 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
107 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
105 | + if (empty($sets[$primary_key])) { |
|
106 | + if ( ! isset($sets['record_create_user'])) { |
|
107 | + $sets['record_create_user'] = $this->recordUser; |
|
108 | 108 | } |
109 | 109 | |
110 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
111 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
110 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
111 | + $sets['record_create_timestamp'] = $timestamp; |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | } else { |
115 | 115 | foreach ($this->primary_keys as $primary_key) { |
116 | - if (empty($sets[ $primary_key ])) { |
|
117 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
118 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
116 | + if (empty($sets[$primary_key])) { |
|
117 | + if ( ! isset($sets['record_create_user'])) { |
|
118 | + $sets['record_create_user'] = $this->recordUser; |
|
119 | 119 | } |
120 | 120 | |
121 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
122 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
121 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
122 | + $sets['record_create_timestamp'] = $timestamp; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
128 | + $sets['record_update_user'] = $this->recordUser; |
|
129 | 129 | |
130 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
131 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
130 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
131 | + $sets['record_update_timestamp'] = $timestamp; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
@@ -139,18 +139,18 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function updateRecordSets(array &$sets) |
141 | 141 | { |
142 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
143 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
142 | + $sets['record_status'] = $this->recordStatus; |
|
143 | + $sets['record_update_user'] = $this->recordUser; |
|
144 | 144 | |
145 | 145 | $timestamp = $this->isUnixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
146 | 146 | |
147 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
148 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
147 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
148 | + $sets['record_update_timestamp'] = $timestamp; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | if ($this->recordStatus === 'PUBLISH') { |
152 | - $sets[ 'record_delete_timestamp' ] = null; |
|
153 | - $sets[ 'record_delete_user' ] = null; |
|
152 | + $sets['record_delete_timestamp'] = null; |
|
153 | + $sets['record_delete_user'] = null; |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | } |
157 | 157 | \ No newline at end of file |
@@ -220,16 +220,16 @@ discard block |
||
220 | 220 | $familyRelationships = []; |
221 | 221 | |
222 | 222 | foreach ([ |
223 | - 'PARENT', |
|
224 | - 'CHILD', |
|
225 | - 'SPOUSE', |
|
226 | - 'SIBLING', |
|
227 | - 'GRANDPARENTS', |
|
228 | - 'GRANDCHILD', |
|
229 | - 'PARENTS_SIBLING', |
|
230 | - 'SIBLINGS_CHILD', |
|
231 | - 'AUNTS_UNCLES_CHILD', |
|
232 | - ] as $relationship |
|
223 | + 'PARENT', |
|
224 | + 'CHILD', |
|
225 | + 'SPOUSE', |
|
226 | + 'SIBLING', |
|
227 | + 'GRANDPARENTS', |
|
228 | + 'GRANDCHILD', |
|
229 | + 'PARENTS_SIBLING', |
|
230 | + 'SIBLINGS_CHILD', |
|
231 | + 'AUNTS_UNCLES_CHILD', |
|
232 | + ] as $relationship |
|
233 | 233 | ) { |
234 | 234 | $familyRelationships[ $relationship ] = $this->language->getLine($relationship); |
235 | 235 | } |
@@ -245,12 +245,12 @@ discard block |
||
245 | 245 | $statuses = []; |
246 | 246 | |
247 | 247 | foreach ([ |
248 | - 'PUBLISH', |
|
249 | - 'UNPUBLISH', |
|
250 | - 'DRAFT', |
|
251 | - 'ARCHIVED', |
|
252 | - 'TRASH', |
|
253 | - ] as $status |
|
248 | + 'PUBLISH', |
|
249 | + 'UNPUBLISH', |
|
250 | + 'DRAFT', |
|
251 | + 'ARCHIVED', |
|
252 | + 'TRASH', |
|
253 | + ] as $status |
|
254 | 254 | ) { |
255 | 255 | $statuses[ $status ] = $this->language->getLine($status); |
256 | 256 | } |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | $visibilities = []; |
270 | 270 | |
271 | 271 | foreach ([ |
272 | - 'PUBLIC', |
|
273 | - 'PRIVATE', |
|
274 | - 'MEMBER', |
|
275 | - ] as $visibility |
|
272 | + 'PUBLIC', |
|
273 | + 'PRIVATE', |
|
274 | + 'MEMBER', |
|
275 | + ] as $visibility |
|
276 | 276 | ) { |
277 | 277 | $visibilities[ $visibility ] = $this->language->getLine($visibility); |
278 | 278 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $religions = []; |
41 | 41 | |
42 | 42 | foreach (['ATHEIST', 'HINDU', 'BUDDHA', 'MOSLEM', 'CHRISTIAN', 'CATHOLIC', 'UNDEFINED'] as $religion) { |
43 | - $religions[ $religion ] = $this->language->getLine($religion); |
|
43 | + $religions[$religion] = $this->language->getLine($religion); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | return $religions; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $genders = []; |
55 | 55 | |
56 | 56 | foreach (['MALE', 'FEMALE', 'UNDEFINED'] as $gender) { |
57 | - $genders[ $gender ] = $this->language->getLine($gender); |
|
57 | + $genders[$gender] = $this->language->getLine($gender); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return $genders; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $maritals = []; |
69 | 69 | |
70 | 70 | foreach (['SINGLE', 'MARRIED', 'DIVORCED', 'UNDEFINED'] as $marital) { |
71 | - $maritals[ $marital ] = $this->language->getLine($marital); |
|
71 | + $maritals[$marital] = $this->language->getLine($marital); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return $maritals; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $bloodTypes = []; |
83 | 83 | |
84 | 84 | foreach (['A', 'B', 'AB', 'O', 'UNDEFINED'] as $bloodType) { |
85 | - $bloodTypes[ $bloodType ] = $this->language->getLine($bloodType); |
|
85 | + $bloodTypes[$bloodType] = $this->language->getLine($bloodType); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | return $bloodTypes; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | for ($i = $start; $i <= $end; $i++) { |
107 | 107 | $time = strtotime($year . 'W' . $week . $i); |
108 | - $days[ strtoupper(date('D', $time)) ] = $this->language->getLine( |
|
108 | + $days[strtoupper(date('D', $time))] = $this->language->getLine( |
|
109 | 109 | 'CAL_' . strtoupper(date($labelFormat, $time))); |
110 | 110 | } |
111 | 111 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | if ($leading) { |
127 | 127 | $date = strlen($date) == 1 ? '0' . $date : $date; |
128 | 128 | } |
129 | - $dates[ $date ] = $date; |
|
129 | + $dates[$date] = $date; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return $dates; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if ($leading) { |
149 | 149 | $month = strlen($month) == 1 ? '0' . $month : $month; |
150 | 150 | } |
151 | - $months[ $month ] = $this->language->getLine(strtoupper('CAL_' . date('F', |
|
151 | + $months[$month] = $this->language->getLine(strtoupper('CAL_' . date('F', |
|
152 | 152 | strtotime('1-' . $month . '-2000')))); |
153 | 153 | } |
154 | 154 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $years = []; |
167 | 167 | |
168 | 168 | foreach (range($start, $end) as $year) { |
169 | - $years[ $year ] = $year; |
|
169 | + $years[$year] = $year; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return $years; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $identities = []; |
181 | 181 | |
182 | 182 | foreach (['UNDEFINED', 'IDENTITY_CARD', 'STUDENT_CARD', 'DRIVER_LICENSE', 'PASSPORT'] as $identity) { |
183 | - $identities[ $identity ] = $this->language->getLine($identity); |
|
183 | + $identities[$identity] = $this->language->getLine($identity); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | return $identities; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | { |
194 | 194 | $sizes = []; |
195 | 195 | foreach (['XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'] as $size) { |
196 | - $sizes[ $size ] = $size; |
|
196 | + $sizes[$size] = $size; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | return $sizes; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | { |
207 | 207 | $boolean = []; |
208 | 208 | foreach (['YES', 'NO'] as $bool) { |
209 | - $boolean[ $bool ] = $this->language->getLine('BOOL_' . $bool); |
|
209 | + $boolean[$bool] = $this->language->getLine('BOOL_' . $bool); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | return $boolean; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | 'AUNTS_UNCLES_CHILD', |
232 | 232 | ] as $relationship |
233 | 233 | ) { |
234 | - $familyRelationships[ $relationship ] = $this->language->getLine($relationship); |
|
234 | + $familyRelationships[$relationship] = $this->language->getLine($relationship); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | return $familyRelationships; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | 'TRASH', |
253 | 253 | ] as $status |
254 | 254 | ) { |
255 | - $statuses[ $status ] = $this->language->getLine($status); |
|
255 | + $statuses[$status] = $this->language->getLine($status); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | return $statuses; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | 'MEMBER', |
275 | 275 | ] as $visibility |
276 | 276 | ) { |
277 | - $visibilities[ $visibility ] = $this->language->getLine($visibility); |
|
277 | + $visibilities[$visibility] = $this->language->getLine($visibility); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | return $visibilities; |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $languages = []; |
293 | 293 | |
294 | 294 | foreach ($this->language->getRegistry() as $language) { |
295 | - $languages[ $language->getParameter() ] = $language->getProperties()->name; |
|
295 | + $languages[$language->getParameter()] = $language->getProperties()->name; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | return $languages; |
@@ -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 |