@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | public function offsetGet($offset) |
63 | 63 | { |
64 | - if($this->offsetExists($offset)) { |
|
64 | + if ($this->offsetExists($offset)) { |
|
65 | 65 | return parent::offsetGet($offset); |
66 | 66 | } elseif (null !== ($result = $this->__call($offset))) { |
67 | 67 | return $result; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | if (method_exists($model, $method)) { |
80 | 80 | $model->row = $this; |
81 | 81 | |
82 | - if(false !== ($result = call_user_func_array([&$model, $method], $args))) { |
|
82 | + if (false !== ($result = call_user_func_array([&$model, $method], $args))) { |
|
83 | 83 | $this->offsetSet($method, $result); |
84 | 84 | |
85 | 85 | return $result; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $args = func_get_args(); |
56 | 56 | |
57 | 57 | if ($countArgs = count($args)) { |
58 | - if(services()->has('config')) { |
|
58 | + if (services()->has('config')) { |
|
59 | 59 | $config = services('config'); |
60 | 60 | |
61 | 61 | if ($countArgs == 1) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | function cache() |
84 | 84 | { |
85 | - if(services()->has('cache')) { |
|
85 | + if (services()->has('cache')) { |
|
86 | 86 | return services()->get('cache'); |
87 | 87 | } |
88 | 88 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | function hooks() |
104 | 104 | { |
105 | - if(services()->has('hooks')) { |
|
105 | + if (services()->has('hooks')) { |
|
106 | 106 | return services()->get('hooks'); |
107 | 107 | } |
108 | 108 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $args = func_get_args(); |
142 | 142 | |
143 | 143 | if (count($args)) { |
144 | - return o2system()->models->get($args[ 0 ]); |
|
144 | + return o2system()->models->get($args[0]); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | return o2system()->models; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $args = func_get_args(); |
164 | 164 | |
165 | 165 | if (count($args)) { |
166 | - return o2system()->modules->getModule($args[ 0 ]); |
|
166 | + return o2system()->modules->getModule($args[0]); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | return o2system()->modules; |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | $args = func_get_args(); |
202 | 202 | |
203 | 203 | if (count($args)) { |
204 | - if(isset($_SESSION[ $args[0] ])) { |
|
205 | - return $_SESSION[ $args[0] ]; |
|
204 | + if (isset($_SESSION[$args[0]])) { |
|
205 | + return $_SESSION[$args[0]]; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | return null; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $args = func_get_args(); |
244 | 244 | |
245 | 245 | if (count($args)) { |
246 | - if(services()->has('view')) { |
|
246 | + if (services()->has('view')) { |
|
247 | 247 | $view = services('view'); |
248 | 248 | |
249 | 249 | return call_user_func_array([&$view, 'load'], $args); |
@@ -37,9 +37,9 @@ |
||
37 | 37 | public function __construct() |
38 | 38 | { |
39 | 39 | if ($config = config()->loadFile('database', true)) { |
40 | - if ( ! empty($config[ 'default' ][ 'hostname' ]) AND ! empty($config[ 'default' ][ 'username' ])) { |
|
40 | + if ( ! empty($config['default']['hostname']) AND ! empty($config['default']['username'])) { |
|
41 | 41 | |
42 | - if(profiler() !== false) { |
|
42 | + if (profiler() !== false) { |
|
43 | 43 | profiler()->watch('Starting Database Service'); |
44 | 44 | } |
45 | 45 |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function push($module) |
100 | 100 | { |
101 | - if (!in_array($module->getNamespace(), ['O2System\Kernel\\', 'O2System\Framework\\', 'App\\'])) { |
|
101 | + if ( ! in_array($module->getNamespace(), ['O2System\Kernel\\', 'O2System\Framework\\', 'App\\'])) { |
|
102 | 102 | $this->autoload($module); |
103 | 103 | |
104 | 104 | parent::push($module); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | $this->autoloadHelpers($module); |
116 | 116 | |
117 | - if (!in_array($module->getType(), ['KERNEL', 'FRAMEWORK'])) { |
|
117 | + if ( ! in_array($module->getType(), ['KERNEL', 'FRAMEWORK'])) { |
|
118 | 118 | // Add Public Dir |
119 | 119 | loader()->addPublicDir($module->getPublicDir()); |
120 | 120 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | */ |
360 | 360 | public function loadRegistry() |
361 | 361 | { |
362 | - if(empty($this->registry)) { |
|
362 | + if (empty($this->registry)) { |
|
363 | 363 | $cacheItemPool = cache()->getItemPool('default'); |
364 | 364 | |
365 | 365 | if (cache()->hasItemPool('registry')) { |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | ->setIndent(2) |
435 | 435 | ->setNewLinesAfter(1) |
436 | 436 | ); |
437 | - } elseif (!is_array($packageJsonMetadata)) { |
|
437 | + } elseif ( ! is_array($packageJsonMetadata)) { |
|
438 | 438 | continue; |
439 | 439 | } |
440 | 440 | |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | ) |
465 | 465 | ); |
466 | 466 | |
467 | - $moduleSegments = array_map(function ($string) { |
|
467 | + $moduleSegments = array_map(function($string) { |
|
468 | 468 | return dash(snakecase($string)); |
469 | 469 | }, $moduleSegments); |
470 | 470 | |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | { |
543 | 543 | $pluralTypes = plural(strtolower($type)); |
544 | 544 | |
545 | - if (!in_array($pluralTypes, $this->types)) { |
|
545 | + if ( ! in_array($pluralTypes, $this->types)) { |
|
546 | 546 | array_push($this->types, $pluralTypes); |
547 | 547 | } |
548 | 548 | |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | { |
687 | 687 | $segments = is_array($segments) ? implode('/', $segments) : $segments; |
688 | 688 | |
689 | - if(is_string($segments)) { |
|
689 | + if (is_string($segments)) { |
|
690 | 690 | return (bool)array_key_exists($segments, $this->registry); |
691 | 691 | } |
692 | 692 |
@@ -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) { |