@@ -85,11 +85,11 @@ |
||
85 | 85 | $subNamespace |
86 | 86 | )) . '\\'; |
87 | 87 | |
88 | - $vars[ 'CREATE_DATETIME' ] = date('d/m/Y H:m'); |
|
89 | - $vars[ 'NAMESPACE' ] = trim($classNamespace, '\\'); |
|
90 | - $vars[ 'PACKAGE' ] = '\\' . trim($classNamespace, '\\'); |
|
91 | - $vars[ 'CLASS' ] = $className; |
|
92 | - $vars[ 'FILEPATH' ] = $filePath; |
|
88 | + $vars['CREATE_DATETIME'] = date('d/m/Y H:m'); |
|
89 | + $vars['NAMESPACE'] = trim($classNamespace, '\\'); |
|
90 | + $vars['PACKAGE'] = '\\' . trim($classNamespace, '\\'); |
|
91 | + $vars['CLASS'] = $className; |
|
92 | + $vars['FILEPATH'] = $filePath; |
|
93 | 93 | |
94 | 94 | $phpTemplate = <<<PHPTEMPLATE |
95 | 95 | <?php |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | public function optionName($name) |
40 | 40 | { |
41 | - if(empty($this->optionPath)) { |
|
41 | + if (empty($this->optionPath)) { |
|
42 | 42 | $this->optionPath = PATH_RESOURCES . 'themes' . DIRECTORY_SEPARATOR; |
43 | 43 | } |
44 | 44 | |
@@ -78,18 +78,18 @@ discard block |
||
78 | 78 | // Make default structure |
79 | 79 | mkdir($themePath . 'assets' . DIRECTORY_SEPARATOR, 0777, true); |
80 | 80 | |
81 | - foreach(['css','js', 'img', 'fonts', 'media', 'packages'] as $assetsDir) { |
|
81 | + foreach (['css', 'js', 'img', 'fonts', 'media', 'packages'] as $assetsDir) { |
|
82 | 82 | mkdir($themePath . 'assets' . DIRECTORY_SEPARATOR . $assetsDir . DIRECTORY_SEPARATOR, 0777, true); |
83 | 83 | } |
84 | 84 | |
85 | 85 | mkdir($themePath . 'partials' . DIRECTORY_SEPARATOR, 0777, true); |
86 | 86 | |
87 | - $jsProps[ 'name' ] = readable( |
|
87 | + $jsProps['name'] = readable( |
|
88 | 88 | $this->optionName, |
89 | 89 | true |
90 | 90 | ); |
91 | 91 | |
92 | - $jsProps[ 'created' ] = date('d M Y'); |
|
92 | + $jsProps['created'] = date('d M Y'); |
|
93 | 93 | |
94 | 94 | file_put_contents($themePath . 'theme.jsprop', json_encode($jsProps, JSON_PRETTY_PRINT)); |
95 | 95 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | </html> |
111 | 111 | THEME; |
112 | 112 | |
113 | - file_put_contents($themePath . 'theme.phtml', str_replace('@','$',$themeTemplate)); |
|
113 | + file_put_contents($themePath . 'theme.phtml', str_replace('@', '$', $themeTemplate)); |
|
114 | 114 | |
115 | 115 | if (is_dir($themePath)) { |
116 | 116 | output()->write( |
@@ -85,11 +85,11 @@ |
||
85 | 85 | $subNamespace |
86 | 86 | )) . '\\'; |
87 | 87 | |
88 | - $vars[ 'CREATE_DATETIME' ] = date('d/m/Y H:m'); |
|
89 | - $vars[ 'NAMESPACE' ] = trim($classNamespace, '\\'); |
|
90 | - $vars[ 'PACKAGE' ] = '\\' . trim($classNamespace, '\\'); |
|
91 | - $vars[ 'CLASS' ] = $className; |
|
92 | - $vars[ 'FILEPATH' ] = $filePath; |
|
88 | + $vars['CREATE_DATETIME'] = date('d/m/Y H:m'); |
|
89 | + $vars['NAMESPACE'] = trim($classNamespace, '\\'); |
|
90 | + $vars['PACKAGE'] = '\\' . trim($classNamespace, '\\'); |
|
91 | + $vars['CLASS'] = $className; |
|
92 | + $vars['FILEPATH'] = $filePath; |
|
93 | 93 | |
94 | 94 | $phpTemplate = <<<PHPTEMPLATE |
95 | 95 | <?php |
@@ -85,11 +85,11 @@ |
||
85 | 85 | $subNamespace |
86 | 86 | )) . '\\'; |
87 | 87 | |
88 | - $vars[ 'CREATE_DATETIME' ] = date('d/m/Y H:m'); |
|
89 | - $vars[ 'NAMESPACE' ] = trim($classNamespace, '\\'); |
|
90 | - $vars[ 'PACKAGE' ] = '\\' . trim($classNamespace, '\\'); |
|
91 | - $vars[ 'CLASS' ] = $className; |
|
92 | - $vars[ 'FILEPATH' ] = $filePath; |
|
88 | + $vars['CREATE_DATETIME'] = date('d/m/Y H:m'); |
|
89 | + $vars['NAMESPACE'] = trim($classNamespace, '\\'); |
|
90 | + $vars['PACKAGE'] = '\\' . trim($classNamespace, '\\'); |
|
91 | + $vars['CLASS'] = $className; |
|
92 | + $vars['FILEPATH'] = $filePath; |
|
93 | 93 | |
94 | 94 | $phpTemplate = <<<PHPTEMPLATE |
95 | 95 | <?php |
@@ -62,7 +62,7 @@ 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'])) { |
|
65 | + if (isset($properties['config'])) { |
|
66 | 66 | $this->presets = $properties['presets']; |
67 | 67 | unset($properties['presets']); |
68 | 68 | } |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | { |
158 | 158 | $extensions = ['.php', '.phtml', '.html', '.tpl']; |
159 | 159 | |
160 | - if (isset($this->presets[ 'extensions' ])) { |
|
161 | - array_unshift($partialsExtensions, $this->presets[ 'extension' ]); |
|
162 | - } elseif (isset($this->presets[ 'extension' ])) { |
|
163 | - array_unshift($extensions, $this->presets[ 'extension' ]); |
|
160 | + if (isset($this->presets['extensions'])) { |
|
161 | + array_unshift($partialsExtensions, $this->presets['extension']); |
|
162 | + } elseif (isset($this->presets['extension'])) { |
|
163 | + array_unshift($extensions, $this->presets['extension']); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | foreach ($extensions as $extension) { |
@@ -359,12 +359,12 @@ |
||
359 | 359 | $session->set('language', language()->getDefault()); |
360 | 360 | } |
361 | 361 | |
362 | - if (config('security')->protection[ 'csrf' ] === true) { |
|
362 | + if (config('security')->protection['csrf'] === true) { |
|
363 | 363 | $csrfProtection = new Security\Protections\Csrf(); |
364 | 364 | $this->services->add($csrfProtection, 'csrfProtection'); |
365 | 365 | } |
366 | 366 | |
367 | - if (config('security')->protection[ 'xss' ] === true) { |
|
367 | + if (config('security')->protection['xss'] === true) { |
|
368 | 368 | $csrfProtection = new Security\Protections\Xss(); |
369 | 369 | $this->services->add($xssProtection, 'xssProtection'); |
370 | 370 | } |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | |
142 | 142 | if (is_dir($baseDirectory)) { |
143 | 143 | // initialize the namespace prefix array |
144 | - if (isset($this->namespaceDirs[ $namespace ]) === false) { |
|
145 | - $this->namespaceDirs[ $namespace ] = []; |
|
144 | + if (isset($this->namespaceDirs[$namespace]) === false) { |
|
145 | + $this->namespaceDirs[$namespace] = []; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | // retain the base directory for the namespace prefix |
149 | - if ( ! in_array($baseDirectory, $this->namespaceDirs[ $namespace ])) { |
|
149 | + if ( ! in_array($baseDirectory, $this->namespaceDirs[$namespace])) { |
|
150 | 150 | if ($prepend) { |
151 | - array_unshift($this->namespaceDirs[ $namespace ], $baseDirectory); |
|
151 | + array_unshift($this->namespaceDirs[$namespace], $baseDirectory); |
|
152 | 152 | } else { |
153 | - array_push($this->namespaceDirs[ $namespace ], $baseDirectory); |
|
153 | + array_push($this->namespaceDirs[$namespace], $baseDirectory); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | - $this->namespaceDirsMap[ $baseDirectory ] = $namespace; |
|
157 | + $this->namespaceDirsMap[$baseDirectory] = $namespace; |
|
158 | 158 | |
159 | 159 | // Register Namespace Language |
160 | 160 | language()->addFilePath($baseDirectory); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | if (is_dir($publicDir) and ! in_array($publicDir, $this->publicDirs)) { |
194 | 194 | if (isset($offset)) { |
195 | - $this->publicDirs[ $offset ] = $publicDir; |
|
195 | + $this->publicDirs[$offset] = $publicDir; |
|
196 | 196 | } else { |
197 | 197 | $this->publicDirs[] = $publicDir; |
198 | 198 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | if (is_dir($resourcesDir) and ! in_array($resourcesDir, $this->resourcesDirs)) { |
219 | 219 | if (isset($offset)) { |
220 | - $this->resourcesDirs[ $offset ] = $resourcesDir; |
|
220 | + $this->resourcesDirs[$offset] = $resourcesDir; |
|
221 | 221 | } else { |
222 | 222 | $this->resourcesDirs[] = $resourcesDir; |
223 | 223 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $dir = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
276 | 276 | |
277 | 277 | if (array_key_exists($dir, $this->namespaceDirsMap)) { |
278 | - return $this->namespaceDirsMap[ $dir ]; |
|
278 | + return $this->namespaceDirsMap[$dir]; |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | return false; |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $namespace = trim($namespace, '\\') . '\\'; |
317 | 317 | |
318 | 318 | if (array_key_exists($namespace, $this->namespaceDirs)) { |
319 | - return $this->namespaceDirs[ $namespace ]; |
|
319 | + return $this->namespaceDirs[$namespace]; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | return false; |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | if ($this->requireFile($helper)) { |
342 | - $this->loadedHelpers[ pathinfo($helper, PATHINFO_FILENAME) ][] = $helper; |
|
342 | + $this->loadedHelpers[pathinfo($helper, PATHINFO_FILENAME)][] = $helper; |
|
343 | 343 | |
344 | 344 | return; |
345 | 345 | } |
@@ -355,17 +355,17 @@ discard block |
||
355 | 355 | } |
356 | 356 | |
357 | 357 | if ( ! array_key_exists($helper, $this->loadedHelpers)) { |
358 | - $this->loadedHelpers[ $helper ] = []; |
|
358 | + $this->loadedHelpers[$helper] = []; |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | foreach ($helperDirectories as $helperDirectory) { |
362 | 362 | |
363 | 363 | $helperFilePath = $helperDirectory . studlycase($helper) . '.php'; |
364 | 364 | |
365 | - if (in_array($helperFilePath, $this->loadedHelpers[ $helper ])) { |
|
365 | + if (in_array($helperFilePath, $this->loadedHelpers[$helper])) { |
|
366 | 366 | continue; |
367 | 367 | } elseif ($this->requireFile($helperFilePath)) { |
368 | - $this->loadedHelpers[ $helper ][] = $helperFilePath; |
|
368 | + $this->loadedHelpers[$helper][] = $helperFilePath; |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | if (false !== ($modules = modules()->getRegistry())) { |
397 | 397 | foreach ($modules as $module) { |
398 | 398 | if ($module instanceof Module) { |
399 | - if (empty($this->namespaceDirs[ $module->getNamespace() ])) { |
|
399 | + if (empty($this->namespaceDirs[$module->getNamespace()])) { |
|
400 | 400 | $this->addNamespace($module->getNamespace(), $module->getRealPath()); |
401 | 401 | } |
402 | 402 | } |
@@ -458,12 +458,12 @@ discard block |
||
458 | 458 | public function loadMappedFile($namespace, $relativeClass) |
459 | 459 | { |
460 | 460 | // are there any base directories for this namespace prefix? |
461 | - if (isset($this->namespaceDirs[ $namespace ]) === false) { |
|
461 | + if (isset($this->namespaceDirs[$namespace]) === false) { |
|
462 | 462 | return false; |
463 | 463 | } |
464 | 464 | |
465 | 465 | // look through base directories for this namespace prefix |
466 | - foreach ($this->namespaceDirs[ $namespace ] as $namespaceDirectory) { |
|
466 | + foreach ($this->namespaceDirs[$namespace] as $namespaceDirectory) { |
|
467 | 467 | |
468 | 468 | // replace the namespace prefix with the base directory, |
469 | 469 | // replace namespace separators with directory separators |
@@ -528,9 +528,9 @@ discard block |
||
528 | 528 | public function services(array $classes) |
529 | 529 | { |
530 | 530 | foreach ($classes as $name => $class) { |
531 | - if(is_numeric($name)) { |
|
531 | + if (is_numeric($name)) { |
|
532 | 532 | services()->load($class); |
533 | - } elseif(is_string($name)) { |
|
533 | + } elseif (is_string($name)) { |
|
534 | 534 | services()->load($class, $name); |
535 | 535 | } |
536 | 536 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | |
548 | 548 | public function models(array $models) |
549 | 549 | { |
550 | - foreach($models as $model) { |
|
550 | + foreach ($models as $model) { |
|
551 | 551 | models()->load($model); |
552 | 552 | } |
553 | 553 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function loadRegistry() |
61 | 61 | { |
62 | - if(empty($this->registry)) { |
|
62 | + if (empty($this->registry)) { |
|
63 | 63 | $cacheItemPool = cache()->getItemPool('default'); |
64 | 64 | |
65 | 65 | if (cache()->hasItemPool('registry')) { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | ); |
126 | 126 | } |
127 | 127 | |
128 | - $registry[ $package->getDirName() ] = $package; |
|
128 | + $registry[$package->getDirName()] = $package; |
|
129 | 129 | } elseif (is_cli()) { |
130 | 130 | output()->verbose( |
131 | 131 | (new Format()) |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function registered($package) |
157 | 157 | { |
158 | - return isset($this->registry[ $package ]); |
|
158 | + return isset($this->registry[$package]); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | // ------------------------------------------------------------------------ |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | { |
172 | 172 | if (isset($package)) { |
173 | 173 | if ($this->registered($package)) { |
174 | - return $this->registry[ $package ]; |
|
174 | + return $this->registry[$package]; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | return false; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | public function getDefaultMetadata() |
184 | 184 | { |
185 | - return $this->getRegistry( $this->getDefault() ); |
|
185 | + return $this->getRegistry($this->getDefault()); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | // ------------------------------------------------------------------------ |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | $first = reset($this->storage); |
42 | - if ( ! isset($first[ $this->primaryKey ])) { |
|
42 | + if ( ! isset($first[$this->primaryKey])) { |
|
43 | 43 | $keys = $first->getKeys(); |
44 | 44 | $this->primaryKey = reset($keys); |
45 | 45 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | public function get($property) |
50 | 50 | { |
51 | - if (empty($get[ $property ])) { |
|
51 | + if (empty($get[$property])) { |
|
52 | 52 | if (services()->has($property)) { |
53 | 53 | return services()->get($property); |
54 | 54 | } elseif (array_key_exists($property, $this->validSubModels)) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | final protected function loadSubModel($model) |
65 | 65 | { |
66 | - if (is_file($this->validSubModels[ $model ])) { |
|
66 | + if (is_file($this->validSubModels[$model])) { |
|
67 | 67 | $className = '\\' . get_called_class() . '\\' . ucfirst($model); |
68 | 68 | $className = str_replace('\Base\\Model', '\Models', $className); |
69 | 69 |