@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function setApp($app) |
66 | 66 | { |
67 | - if($app = modules()->getApp($app)) { |
|
67 | + if ($app = modules()->getApp($app)) { |
|
68 | 68 | $this->app = $app; |
69 | 69 | } |
70 | 70 | |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | if (isset($account)) { |
103 | 103 | foreach ($account as $key => $value) { |
104 | 104 | if (strpos($key, 'record') !== false) { |
105 | - unset($account[ $key ]); |
|
105 | + unset($account[$key]); |
|
106 | 106 | } elseif (in_array($key, |
107 | 107 | ['password', 'pin', 'token', 'sso', 'id_sys_user', 'id_sys_module', 'id_sys_module_role'])) { |
108 | - unset($account[ $key ]); |
|
108 | + unset($account[$key]); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $column = 'id'; |
135 | 135 | } elseif (filter_var($username, FILTER_VALIDATE_EMAIL)) { |
136 | 136 | $column = 'email'; |
137 | - } elseif (preg_match($this->config[ 'msisdnRegex' ], $username)) { |
|
137 | + } elseif (preg_match($this->config['msisdnRegex'], $username)) { |
|
138 | 138 | $column = 'msisdn'; |
139 | 139 | } |
140 | 140 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | public function loggedIn() |
159 | 159 | { |
160 | 160 | if (parent::loggedIn()) { |
161 | - $account = new Account($_SESSION[ 'account' ]); |
|
161 | + $account = new Account($_SESSION['account']); |
|
162 | 162 | |
163 | 163 | if ($user = models('users')->findWhere(['username' => $account->username], 1)) { |
164 | 164 | // Store Account Profile |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $column = 'id'; |
208 | 208 | } elseif (filter_var($username, FILTER_VALIDATE_EMAIL)) { |
209 | 209 | $column = 'email'; |
210 | - } elseif (preg_match($this->config[ 'msisdnRegex' ], $username)) { |
|
210 | + } elseif (preg_match($this->config['msisdnRegex'], $username)) { |
|
211 | 211 | $column = 'msisdn'; |
212 | 212 | } elseif (strpos($username, 'token-') !== false) { |
213 | 213 | $username = str_replace('token-', '', $username); |
@@ -222,15 +222,15 @@ discard block |
||
222 | 222 | |
223 | 223 | foreach ($account as $key => $value) { |
224 | 224 | if (strpos($key, 'record') !== false) { |
225 | - unset($account[ $key ]); |
|
225 | + unset($account[$key]); |
|
226 | 226 | } elseif (in_array($key, ['password', 'pin', 'token', 'sso'])) { |
227 | - unset($account[ $key ]); |
|
227 | + unset($account[$key]); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | 231 | if ($column === 'token') { |
232 | 232 | models('users')->update([ |
233 | - 'id' => $account[ 'id' ], |
|
233 | + 'id' => $account['id'], |
|
234 | 234 | 'token' => null, |
235 | 235 | ]); |
236 | 236 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | public function getIframeCode() |
255 | 255 | { |
256 | 256 | if ($this->signedOn() && $this->loggedIn() === false) { |
257 | - return '<iframe id="sign-on-iframe" width="1" height="1" src="' . rtrim($this->config[ 'sso' ][ 'server' ], |
|
257 | + return '<iframe id="sign-on-iframe" width="1" height="1" src="' . rtrim($this->config['sso']['server'], |
|
258 | 258 | '/') . '" style="display: none; visibility: hidden;"></iframe>'; |
259 | 259 | } |
260 | 260 |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $directory = new \RecursiveIteratorIterator(new \RecursiveCallbackFilterIterator( |
97 | 97 | new \RecursiveDirectoryIterator(PATH_ROOT, |
98 | 98 | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), |
99 | - function ($current, $key, $iterator) { |
|
99 | + function($current, $key, $iterator) { |
|
100 | 100 | if ($current->isDir()) { |
101 | 101 | // exclude build directory |
102 | 102 | if (in_array($current->getFilename(), [ |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | $files[] = $packageJsonFileInfo; |
120 | 120 | |
121 | - if ($packageJsonFileInfo[ 'filename' ] === 'language') { |
|
121 | + if ($packageJsonFileInfo['filename'] === 'language') { |
|
122 | 122 | if (is_cli()) { |
123 | 123 | output()->verbose( |
124 | 124 | (new Format()) |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | ); |
142 | 142 | } |
143 | 143 | |
144 | - $registry[ $package->getDirName() ] = $package; |
|
144 | + $registry[$package->getDirName()] = $package; |
|
145 | 145 | } elseif (is_cli()) { |
146 | 146 | output()->verbose( |
147 | 147 | (new Format()) |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | { |
186 | 186 | if (isset($package)) { |
187 | 187 | if ($this->registered($package)) { |
188 | - return $this->registry[ $package ]; |
|
188 | + return $this->registry[$package]; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | return false; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function registered($package) |
207 | 207 | { |
208 | - return isset($this->registry[ $package ]); |
|
208 | + return isset($this->registry[$package]); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | // ------------------------------------------------------------------------ |
@@ -487,11 +487,11 @@ |
||
487 | 487 | $moduleParentSegments = []; |
488 | 488 | |
489 | 489 | foreach ([ |
490 | - 'apps', |
|
491 | - 'modules', |
|
492 | - 'components', |
|
493 | - 'plugins', |
|
494 | - ] as $moduleType |
|
490 | + 'apps', |
|
491 | + 'modules', |
|
492 | + 'components', |
|
493 | + 'plugins', |
|
494 | + ] as $moduleType |
|
495 | 495 | ) { |
496 | 496 | if (false !== ($segmentKey = array_search($modularType, $moduleSegments))) { |
497 | 497 | $moduleParentSegments = array_slice($moduleSegments, 0, $segmentKey); |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | |
189 | 189 | if (isset($config) AND is_array($config)) { |
190 | 190 | // Set default timezone |
191 | - if (isset($config[ 'datetime' ][ 'timezone' ])) { |
|
192 | - date_default_timezone_set($config[ 'datetime' ][ 'timezone' ]); |
|
191 | + if (isset($config['datetime']['timezone'])) { |
|
192 | + date_default_timezone_set($config['datetime']['timezone']); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | // Setup Language Ideom and Locale |
196 | - if (isset($config[ 'language' ])) { |
|
197 | - language()->setDefault($config[ 'language' ]); |
|
196 | + if (isset($config['language'])) { |
|
197 | + language()->setDefault($config['language']); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | config()->merge($config); |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | $packageJsonFile = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $packageJsonFile); |
425 | 425 | $packageJsonFileInfo = pathinfo($packageJsonFile); |
426 | 426 | |
427 | - if ($packageJsonFileInfo[ 'filename' ] === 'widget' or |
|
428 | - $packageJsonFileInfo[ 'filename' ] === 'language' or |
|
427 | + if ($packageJsonFileInfo['filename'] === 'widget' or |
|
428 | + $packageJsonFileInfo['filename'] === 'language' or |
|
429 | 429 | strpos($packageJsonFile, '.svn') !== false // subversion properties file conflict. |
430 | 430 | ) { |
431 | 431 | continue; |
@@ -455,8 +455,8 @@ discard block |
||
455 | 455 | } |
456 | 456 | |
457 | 457 | if (strpos($packageJsonFile, |
458 | - $modularType = ucfirst(plural($packageJsonFileInfo[ 'filename' ])) . DIRECTORY_SEPARATOR) === false) { |
|
459 | - $modularType = ucfirst($packageJsonFileInfo[ 'filename' ]) . DIRECTORY_SEPARATOR; |
|
458 | + $modularType = ucfirst(plural($packageJsonFileInfo['filename'])) . DIRECTORY_SEPARATOR) === false) { |
|
459 | + $modularType = ucfirst($packageJsonFileInfo['filename']) . DIRECTORY_SEPARATOR; |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | $modularType = strtolower(rtrim($modularType, DIRECTORY_SEPARATOR)); |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | PATH_PUBLIC, |
472 | 472 | PATH_RESOURCES, |
473 | 473 | PATH_APP, |
474 | - $packageJsonFileInfo[ 'basename' ], |
|
474 | + $packageJsonFileInfo['basename'], |
|
475 | 475 | ], |
476 | 476 | '', |
477 | 477 | $packageJsonFile |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | ) |
481 | 481 | ); |
482 | 482 | |
483 | - $moduleSegments = array_map(function ($string) { |
|
483 | + $moduleSegments = array_map(function($string) { |
|
484 | 484 | return dash(snakecase($string)); |
485 | 485 | }, $moduleSegments); |
486 | 486 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | if (false !== ($segmentKey = array_search($modularType, $moduleSegments))) { |
497 | 497 | $moduleParentSegments = array_slice($moduleSegments, 0, $segmentKey); |
498 | 498 | |
499 | - unset($moduleSegments[ $segmentKey ]); |
|
499 | + unset($moduleSegments[$segmentKey]); |
|
500 | 500 | break; |
501 | 501 | } |
502 | 502 | } |
@@ -507,29 +507,29 @@ discard block |
||
507 | 507 | str_replace( |
508 | 508 | PATH_ROOT, |
509 | 509 | '', |
510 | - $packageJsonFileInfo[ 'dirname' ] |
|
510 | + $packageJsonFileInfo['dirname'] |
|
511 | 511 | ), |
512 | 512 | false |
513 | 513 | ); |
514 | 514 | |
515 | - if (isset($packageJsonMetadata[ 'namespace' ])) { |
|
516 | - $moduleNamespace = $packageJsonMetadata[ 'namespace' ]; |
|
517 | - unset($packageJsonMetadata[ 'namespace' ]); |
|
515 | + if (isset($packageJsonMetadata['namespace'])) { |
|
516 | + $moduleNamespace = $packageJsonMetadata['namespace']; |
|
517 | + unset($packageJsonMetadata['namespace']); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | $registryKey = implode('/', $moduleSegments); |
521 | 521 | |
522 | 522 | if ($registryKey === '') { |
523 | - if ($packageJsonFileInfo[ 'dirname' ] . DIRECTORY_SEPARATOR !== PATH_APP and $modularType === 'app') { |
|
523 | + if ($packageJsonFileInfo['dirname'] . DIRECTORY_SEPARATOR !== PATH_APP and $modularType === 'app') { |
|
524 | 524 | $registryKey = dash(snakecase( |
525 | - pathinfo($packageJsonFileInfo[ 'dirname' ], PATHINFO_FILENAME))); |
|
525 | + pathinfo($packageJsonFileInfo['dirname'], PATHINFO_FILENAME))); |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | |
529 | - $registry[ $registryKey ] = (new DataStructures\Module( |
|
530 | - $packageJsonFileInfo[ 'dirname' ] |
|
529 | + $registry[$registryKey] = (new DataStructures\Module( |
|
530 | + $packageJsonFileInfo['dirname'] |
|
531 | 531 | )) |
532 | - ->setType($packageJsonFileInfo[ 'filename' ]) |
|
532 | + ->setType($packageJsonFileInfo['filename']) |
|
533 | 533 | ->setNamespace($moduleNamespace) |
534 | 534 | ->setSegments($moduleSegments) |
535 | 535 | ->setParentSegments($moduleParentSegments) |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | $segment = dash($segment); |
692 | 692 | |
693 | 693 | if ($this->exists($segment)) { |
694 | - if ($this->registry[ $segment ] instanceof DataStructures\Module) { |
|
695 | - return $this->registry[ $segment ]; |
|
694 | + if ($this->registry[$segment] instanceof DataStructures\Module) { |
|
695 | + return $this->registry[$segment]; |
|
696 | 696 | } |
697 | 697 | } |
698 | 698 | |
@@ -728,8 +728,8 @@ discard block |
||
728 | 728 | */ |
729 | 729 | public function first() |
730 | 730 | { |
731 | - if (isset($this->registry[ '' ])) { |
|
732 | - return $this->registry[ '' ]; |
|
731 | + if (isset($this->registry[''])) { |
|
732 | + return $this->registry['']; |
|
733 | 733 | } elseif (reset($this->registry)->type === 'APP') { |
734 | 734 | return reset($this->registry); |
735 | 735 | } |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | $segments = (is_array($segments) ? implode('/', array_map('dash', $segments)) : $segments); |
752 | 752 | |
753 | 753 | if ($this->exists($segments)) { |
754 | - return $this->registry[ $segments ]; |
|
754 | + return $this->registry[$segments]; |
|
755 | 755 | } |
756 | 756 | |
757 | 757 | return false; |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | |
773 | 773 | foreach ($this as $key => $module) { |
774 | 774 | if ($module instanceof DataStructures\Module) { |
775 | - $namespaces[ $key ] = new SplNamespaceInfo($module->getNamespace(), $module->getRealPath()); |
|
775 | + $namespaces[$key] = new SplNamespaceInfo($module->getNamespace(), $module->getRealPath()); |
|
776 | 776 | } |
777 | 777 | } |
778 | 778 |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function setProperties(array $properties) |
197 | 197 | { |
198 | - if (isset($properties[ 'presets' ])) { |
|
199 | - $this->setPresets($properties[ 'presets' ]); |
|
198 | + if (isset($properties['presets'])) { |
|
199 | + $this->setPresets($properties['presets']); |
|
200 | 200 | |
201 | - unset($properties[ 'presets' ]); |
|
201 | + unset($properties['presets']); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | $this->properties = $properties; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $themes = []; |
289 | 289 | foreach ($directory->getTree() as $themeName => $themeTree) { |
290 | 290 | if (($theme = $this->getTheme($themeName)) instanceof Module\Theme) { |
291 | - $themes[ $themeName ] = $theme; |
|
291 | + $themes[$themeName] = $theme; |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | |
516 | 516 | if ( ! empty($controller->name) and ! in_array($controller->getParameter(), |
517 | 517 | ['login', 'pages', 'setup', 'license'])) { |
518 | - $controllers[ $controller->getParameter() ] = $controller; |
|
518 | + $controllers[$controller->getParameter()] = $controller; |
|
519 | 519 | } |
520 | 520 | } |
521 | 521 | } |
@@ -111,7 +111,7 @@ |
||
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | - if(empty($this->methods) and $this->hasMethod('route')) { |
|
114 | + if (empty($this->methods) and $this->hasMethod('route')) { |
|
115 | 115 | $method = $this->getMethod('route'); |
116 | 116 | $method->segment = dash($method->name); |
117 | 117 | $method->segments = implode('/', $segments); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ]); |
86 | 86 | } |
87 | 87 | |
88 | - $update[ $this->primaryKey ] = $child->{$this->primaryKey}; |
|
88 | + $update[$this->primaryKey] = $child->{$this->primaryKey}; |
|
89 | 89 | |
90 | 90 | if ($this->qb |
91 | 91 | ->table($this->table) |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ->update($update = [ |
101 | 101 | 'record_right' => $right, |
102 | 102 | ]); |
103 | - $update[ $this->primaryKey ] = $child->{$this->primaryKey}; |
|
103 | + $update[$this->primaryKey] = $child->{$this->primaryKey}; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | $i++; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | ->select($this->table . '.*') |
257 | 257 | ->from($this->table) |
258 | 258 | ->from($this->table . ' AS node') |
259 | - ->whereBetween($this->table . '.record_left', [ 'node.record_left', 'node.record_right']) |
|
259 | + ->whereBetween($this->table . '.record_left', ['node.record_left', 'node.record_right']) |
|
260 | 260 | ->where([ |
261 | 261 | 'node.' . $this->primaryKey => $id, |
262 | 262 | $this->table . '.' . $this->primaryKey . '!=' => $id, |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | $properties = json_decode(file_get_contents($propFilePath), true); |
63 | 63 | |
64 | 64 | if (json_last_error() === JSON_ERROR_NONE) { |
65 | - if (isset($properties[ 'config' ])) { |
|
66 | - $this->presets = $properties[ 'presets' ]; |
|
67 | - unset($properties[ 'presets' ]); |
|
65 | + if (isset($properties['config'])) { |
|
66 | + $this->presets = $properties['presets']; |
|
67 | + unset($properties['presets']); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $this->properties = $properties; |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | { |
199 | 199 | $extensions = ['.php', '.phtml', '.html', '.tpl']; |
200 | 200 | |
201 | - if (isset($this->presets[ 'extensions' ])) { |
|
202 | - array_unshift($partialsExtensions, $this->presets[ 'extension' ]); |
|
203 | - } elseif (isset($this->presets[ 'extension' ])) { |
|
204 | - array_unshift($extensions, $this->presets[ 'extension' ]); |
|
201 | + if (isset($this->presets['extensions'])) { |
|
202 | + array_unshift($partialsExtensions, $this->presets['extension']); |
|
203 | + } elseif (isset($this->presets['extension'])) { |
|
204 | + array_unshift($extensions, $this->presets['extension']); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | $found = false; |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | if (isset($layout)) { |
254 | 254 | $extensions = ['.php', '.phtml', '.html', '.tpl']; |
255 | 255 | |
256 | - if (isset($this->presets[ 'extensions' ])) { |
|
257 | - array_unshift($partialsExtensions, $this->presets[ 'extension' ]); |
|
258 | - } elseif (isset($this->presets[ 'extension' ])) { |
|
259 | - array_unshift($extensions, $this->presets[ 'extension' ]); |
|
256 | + if (isset($this->presets['extensions'])) { |
|
257 | + array_unshift($partialsExtensions, $this->presets['extension']); |
|
258 | + } elseif (isset($this->presets['extension'])) { |
|
259 | + array_unshift($extensions, $this->presets['extension']); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | foreach ($extensions as $extension) { |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | if ($this->layout instanceof Theme\Layout) { |
291 | 291 | |
292 | 292 | // load parent theme layout |
293 | - if($this->layout->getFilename() !== 'theme') { |
|
293 | + if ($this->layout->getFilename() !== 'theme') { |
|
294 | 294 | $themeLayout = $this->getLayout('theme'); |
295 | 295 | |
296 | 296 | // add theme layout public directory |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | if (method_exists($this, 'getRecordOrdering')) { |
48 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
49 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering(); |
|
48 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
49 | + $sets['record_ordering'] = $this->getRecordOrdering(); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if ($files = input()->files()) { |
62 | 62 | // Uploaded Image Process |
63 | 63 | if (isset($this->uploadedImageKey)) { |
64 | - if (isset($files[ $this->uploadedImageKey ])) { |
|
64 | + if (isset($files[$this->uploadedImageKey])) { |
|
65 | 65 | $upload->process($this->uploadedImageKey); |
66 | 66 | |
67 | 67 | if ($upload->getErrors()) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | } elseif (count($this->uploadedImageKeys)) { |
82 | 82 | foreach ($this->uploadedImageKeys as $uploadedImageKey) { |
83 | - if (isset($files[ $uploadedImageKey ])) { |
|
83 | + if (isset($files[$uploadedImageKey])) { |
|
84 | 84 | $upload->process($uploadedImageKey); |
85 | 85 | |
86 | 86 | if ($upload->getErrors()) { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | // Uploaded File Process |
104 | 104 | if (isset($this->uploadedFileFilepath)) { |
105 | - if (isset($files[ $this->uploadedFileKey ])) { |
|
105 | + if (isset($files[$this->uploadedFileKey])) { |
|
106 | 106 | $upload->process($this->uploadedFileKey); |
107 | 107 | |
108 | 108 | if ($upload->getErrors()) { |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | } elseif (count($this->uploadedFileKeys)) { |
123 | 123 | foreach ($this->uploadedFileKeys as $uploadedFileKey) { |
124 | - if (isset($files[ $uploadedFileKey ])) { |
|
124 | + if (isset($files[$uploadedFileKey])) { |
|
125 | 125 | $upload->process($uploadedFileKey); |
126 | 126 | |
127 | 127 | if ($upload->getErrors()) { |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | |
155 | 155 | $label = false; |
156 | 156 | foreach (['name', 'label', 'title', 'code'] as $labelField) { |
157 | - if (isset($sets[ $labelField ])) { |
|
158 | - session()->setFlash('success', language('SUCCESS_INSERT_WITH_LABEL', $sets[ $labelField ])); |
|
157 | + if (isset($sets[$labelField])) { |
|
158 | + session()->setFlash('success', language('SUCCESS_INSERT_WITH_LABEL', $sets[$labelField])); |
|
159 | 159 | $label = true; |
160 | 160 | break; |
161 | 161 | } |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | |
172 | 172 | $label = false; |
173 | 173 | foreach (['name', 'label', 'title', 'code'] as $labelField) { |
174 | - if (isset($sets[ $labelField ])) { |
|
175 | - session()->setFlash('danger', language('FAILED_INSERT_WITH_LABEL', $sets[ $labelField ])); |
|
174 | + if (isset($sets[$labelField])) { |
|
175 | + session()->setFlash('danger', language('FAILED_INSERT_WITH_LABEL', $sets[$labelField])); |
|
176 | 176 | $label = true; |
177 | 177 | break; |
178 | 178 | } |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
206 | 206 | |
207 | 207 | if (empty($conditions)) { |
208 | - if (isset($sets[ $primaryKey ])) { |
|
209 | - $conditions = [$primaryKey => $sets[ $primaryKey ]]; |
|
208 | + if (isset($sets[$primaryKey])) { |
|
209 | + $conditions = [$primaryKey => $sets[$primaryKey]]; |
|
210 | 210 | } else { |
211 | 211 | $conditions = $sets; |
212 | 212 | } |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | if (method_exists($this, 'insertRecordSets')) { |
241 | 241 | foreach ($sets as $set) { |
242 | 242 | $this->insertRecordSets($set); |
243 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
244 | - $set[ 'record_ordering' ] = $this->getRecordOrdering(); |
|
243 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
244 | + $set['record_ordering'] = $this->getRecordOrdering(); |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | } |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
314 | 314 | |
315 | 315 | if (empty($conditions)) { |
316 | - if (isset($sets[ $primaryKey ])) { |
|
317 | - $conditions = [$primaryKey => $sets[ $primaryKey ]]; |
|
316 | + if (isset($sets[$primaryKey])) { |
|
317 | + $conditions = [$primaryKey => $sets[$primaryKey]]; |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | } |
328 | 328 | |
329 | 329 | if (method_exists($this, 'getRecordOrdering')) { |
330 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
331 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering(); |
|
330 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
331 | + $sets['record_ordering'] = $this->getRecordOrdering(); |
|
332 | 332 | } |
333 | 333 | } |
334 | 334 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | if ($files = input()->files()) { |
345 | 345 | // Uploaded Image Process |
346 | 346 | if (isset($this->uploadedImageKey)) { |
347 | - if (isset($files[ $this->uploadedImageKey ])) { |
|
347 | + if (isset($files[$this->uploadedImageKey])) { |
|
348 | 348 | $upload->process($this->uploadedImageKey); |
349 | 349 | |
350 | 350 | if ($upload->getErrors()) { |
@@ -359,8 +359,8 @@ discard block |
||
359 | 359 | } |
360 | 360 | |
361 | 361 | return false; |
362 | - } elseif ($row->offsetGet($this->uploadedImageKey) !== $upload->getUploadedFiles()->first()[ 'name' ]) { |
|
363 | - $sets[ $this->uploadedImageKey ] = $upload->getUploadedFiles()->first()[ 'name' ]; |
|
362 | + } elseif ($row->offsetGet($this->uploadedImageKey) !== $upload->getUploadedFiles()->first()['name']) { |
|
363 | + $sets[$this->uploadedImageKey] = $upload->getUploadedFiles()->first()['name']; |
|
364 | 364 | |
365 | 365 | if (is_file($filePath = $this->uploadedImageFilePath . $row->offsetGet($this->uploadedImageKey))) { |
366 | 366 | unlink($filePath); |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | } |
370 | 370 | } elseif (count($this->uploadedImageKeys)) { |
371 | 371 | foreach ($this->uploadedImageKeys as $uploadedImageKey) { |
372 | - if (isset($files[ $uploadedImageKey ])) { |
|
372 | + if (isset($files[$uploadedImageKey])) { |
|
373 | 373 | $upload->process($uploadedImageKey); |
374 | 374 | |
375 | 375 | if ($upload->getErrors()) { |
@@ -384,8 +384,8 @@ discard block |
||
384 | 384 | } |
385 | 385 | |
386 | 386 | return false; |
387 | - } elseif ($row->offsetGet($uploadedImageKey) !== $upload->getUploadedFiles()->first()[ 'name' ]) { |
|
388 | - $sets[ $uploadedImageKey ] = $upload->getUploadedFiles()->first()[ 'name' ]; |
|
387 | + } elseif ($row->offsetGet($uploadedImageKey) !== $upload->getUploadedFiles()->first()['name']) { |
|
388 | + $sets[$uploadedImageKey] = $upload->getUploadedFiles()->first()['name']; |
|
389 | 389 | |
390 | 390 | if (is_file($filePath = $this->uploadedImageFilePath . $row->offsetGet($uploadedImageKey))) { |
391 | 391 | unlink($filePath); |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | |
398 | 398 | // Uploaded File Process |
399 | 399 | if (isset($this->uploadedFileFilepath)) { |
400 | - if (isset($files[ $this->uploadedFileKey ])) { |
|
400 | + if (isset($files[$this->uploadedFileKey])) { |
|
401 | 401 | $upload->process($this->uploadedFileKey); |
402 | 402 | |
403 | 403 | if ($upload->getErrors()) { |
@@ -412,8 +412,8 @@ discard block |
||
412 | 412 | } |
413 | 413 | |
414 | 414 | return false; |
415 | - } elseif ($row->offsetGet($this->uploadedFileKey) !== $upload->getUploadedFiles()->first()[ 'name' ]) { |
|
416 | - $sets[ $this->uploadedFileKey ] = $upload->getUploadedFiles()->first()[ 'name' ]; |
|
415 | + } elseif ($row->offsetGet($this->uploadedFileKey) !== $upload->getUploadedFiles()->first()['name']) { |
|
416 | + $sets[$this->uploadedFileKey] = $upload->getUploadedFiles()->first()['name']; |
|
417 | 417 | |
418 | 418 | if (is_file($filePath = $this->uploadedFileFilepath . $row->offsetGet($this->uploadedFileKey))) { |
419 | 419 | unlink($filePath); |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | } |
423 | 423 | } elseif (count($this->uploadedFileKeys)) { |
424 | 424 | foreach ($this->uploadedFileKeys as $uploadedFileKey) { |
425 | - if (isset($files[ $uploadedFileKey ])) { |
|
425 | + if (isset($files[$uploadedFileKey])) { |
|
426 | 426 | $upload->process($uploadedFileKey); |
427 | 427 | |
428 | 428 | if ($upload->getErrors()) { |
@@ -437,8 +437,8 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | return false; |
440 | - } elseif ($row->offsetGet($uploadedFileKey) !== $upload->getUploadedFiles()->first()[ 'name' ]) { |
|
441 | - $sets[ $uploadedFileKey ] = $upload->getUploadedFiles()->first()[ 'name' ]; |
|
440 | + } elseif ($row->offsetGet($uploadedFileKey) !== $upload->getUploadedFiles()->first()['name']) { |
|
441 | + $sets[$uploadedFileKey] = $upload->getUploadedFiles()->first()['name']; |
|
442 | 442 | |
443 | 443 | if (is_file($filePath = $this->uploadedFileFilepath . $row->offsetGet($uploadedFileKey))) { |
444 | 444 | unlink($filePath); |
@@ -458,8 +458,8 @@ discard block |
||
458 | 458 | |
459 | 459 | $label = false; |
460 | 460 | foreach (['name', 'label', 'title', 'code'] as $labelField) { |
461 | - if (isset($sets[ $labelField ])) { |
|
462 | - session()->setFlash('success', language('SUCCESS_UPDATE_WITH_LABEL', $sets[ $labelField ])); |
|
461 | + if (isset($sets[$labelField])) { |
|
462 | + session()->setFlash('success', language('SUCCESS_UPDATE_WITH_LABEL', $sets[$labelField])); |
|
463 | 463 | $label = true; |
464 | 464 | break; |
465 | 465 | } |
@@ -476,8 +476,8 @@ discard block |
||
476 | 476 | |
477 | 477 | $label = false; |
478 | 478 | foreach (['name', 'label', 'title', 'code'] as $labelField) { |
479 | - if (isset($sets[ $labelField ])) { |
|
480 | - session()->setFlash('danger', language('FAILED_UPDATE_WITH_LABEL', $sets[ $labelField ])); |
|
479 | + if (isset($sets[$labelField])) { |
|
480 | + session()->setFlash('danger', language('FAILED_UPDATE_WITH_LABEL', $sets[$labelField])); |
|
481 | 481 | $label = true; |
482 | 482 | break; |
483 | 483 | } |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | |
525 | 525 | if (method_exists($this, 'updateRecordSets')) { |
526 | 526 | foreach ($sets as $key => $set) { |
527 | - $this->updateRecordSets($sets[ $key ]); |
|
527 | + $this->updateRecordSets($sets[$key]); |
|
528 | 528 | } |
529 | 529 | } |
530 | 530 | |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | */ |
741 | 741 | private function updateRecordStatus($id, $recordStatus, $method) |
742 | 742 | { |
743 | - $sets[ 'record_status' ] = $recordStatus; |
|
743 | + $sets['record_status'] = $recordStatus; |
|
744 | 744 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
745 | 745 | |
746 | 746 | if (method_exists($this, 'updateRecordSets')) { |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | private function updateRecordStatusMany(array $ids, $recordStatus, $method) |
781 | 781 | { |
782 | 782 | if (count($ids)) { |
783 | - $sets[ 'record_status' ] = $recordStatus; |
|
783 | + $sets['record_status'] = $recordStatus; |
|
784 | 784 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
785 | 785 | |
786 | 786 | $this->qb->whereIn($primaryKey, $ids); |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | private function updateRecordStatusBy($recordStatus, $method, array $conditions) |
826 | 826 | { |
827 | 827 | if (count($conditions)) { |
828 | - $sets[ 'record_status' ] = $recordStatus; |
|
828 | + $sets['record_status'] = $recordStatus; |
|
829 | 829 | |
830 | 830 | if (method_exists($this, 'updateRecordSets')) { |
831 | 831 | $this->updateRecordSets($sets); |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | private function updateRecordStatusManyBy($recordStatus, $method, array $conditions) |
868 | 868 | { |
869 | 869 | if (count($conditions)) { |
870 | - $sets[ 'record_status' ] = $recordStatus; |
|
870 | + $sets['record_status'] = $recordStatus; |
|
871 | 871 | |
872 | 872 | if (method_exists($this, 'updateRecordSets')) { |
873 | 873 | $this->updateRecordSets($sets); |
@@ -48,11 +48,11 @@ |
||
48 | 48 | $ormResult = new \SplFixedArray($result->count()); |
49 | 49 | |
50 | 50 | foreach ($result as $key => $row) { |
51 | - if(method_exists($model, 'rebuildRow')) { |
|
51 | + if (method_exists($model, 'rebuildRow')) { |
|
52 | 52 | $row = $model->rebuildRow($row); |
53 | 53 | } |
54 | 54 | |
55 | - $ormResult[ $key ] = new Result\Row($row, $model); |
|
55 | + $ormResult[$key] = new Result\Row($row, $model); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | parent::__construct($ormResult->toArray()); |