@@ -38,8 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | parent::__construct('div'); |
40 | 40 | |
41 | - if (isset($attributes[ 'id' ])) { |
|
42 | - $this->entity->setEntityName($attributes[ 'id' ]); |
|
41 | + if (isset($attributes['id'])) { |
|
42 | + $this->entity->setEntityName($attributes['id']); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | if (count($attributes)) { |
@@ -38,8 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | parent::__construct('div'); |
40 | 40 | |
41 | - if (isset($attributes[ 'id' ])) { |
|
42 | - $this->entity->setEntityName($attributes[ 'id' ]); |
|
41 | + if (isset($attributes['id'])) { |
|
42 | + $this->entity->setEntityName($attributes['id']); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | if (count($attributes)) { |
@@ -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,9 +196,9 @@ 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 | - $this->publicDirs[ rtrim(str_replace(PATH_PUBLIC, '', $publicDir), '/') ] = $publicDir; |
|
201 | + $this->publicDirs[rtrim(str_replace(PATH_PUBLIC, '', $publicDir), '/')] = $publicDir; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
@@ -222,9 +222,9 @@ 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 | - $this->resourcesDirs[ rtrim(str_replace(PATH_RESOURCES, '', $resourcesDir), '/') ] = $resourcesDir; |
|
227 | + $this->resourcesDirs[rtrim(str_replace(PATH_RESOURCES, '', $resourcesDir), '/')] = $resourcesDir; |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
@@ -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 | } |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | // autoload presenter assets |
108 | - if (isset($config[ 'assets' ])) { |
|
109 | - $this->assets->autoload($config[ 'assets' ]); |
|
108 | + if (isset($config['assets'])) { |
|
109 | + $this->assets->autoload($config['assets']); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | return $this; |
@@ -183,25 +183,25 @@ discard block |
||
183 | 183 | $storage = $this->storage; |
184 | 184 | |
185 | 185 | // Add Properties |
186 | - $storage[ 'meta' ] = $this->meta; |
|
187 | - $storage[ 'page' ] = $this->page; |
|
188 | - $storage[ 'assets' ] = new SplArrayObject([ |
|
186 | + $storage['meta'] = $this->meta; |
|
187 | + $storage['page'] = $this->page; |
|
188 | + $storage['assets'] = new SplArrayObject([ |
|
189 | 189 | 'head' => $this->assets->getHead(), |
190 | 190 | 'body' => $this->assets->getBody(), |
191 | 191 | ]); |
192 | - $storage[ 'partials' ] = $this->partials; |
|
193 | - $storage[ 'widgets' ] = $this->widgets; |
|
194 | - $storage[ 'theme' ] = $this->theme; |
|
192 | + $storage['partials'] = $this->partials; |
|
193 | + $storage['widgets'] = $this->widgets; |
|
194 | + $storage['theme'] = $this->theme; |
|
195 | 195 | |
196 | 196 | // Add Services |
197 | - $storage[ 'config' ] = config(); |
|
198 | - $storage[ 'language' ] = language(); |
|
199 | - $storage[ 'session' ] = session(); |
|
200 | - $storage[ 'presenter' ] = presenter(); |
|
201 | - $storage[ 'input' ] = input(); |
|
197 | + $storage['config'] = config(); |
|
198 | + $storage['language'] = language(); |
|
199 | + $storage['session'] = session(); |
|
200 | + $storage['presenter'] = presenter(); |
|
201 | + $storage['input'] = input(); |
|
202 | 202 | |
203 | 203 | if (services()->has('csrfProtection')) { |
204 | - $storage[ 'csrfToken' ] = services()->get('csrfProtection')->getToken(); |
|
204 | + $storage['csrfToken'] = services()->get('csrfProtection')->getToken(); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return $storage; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | } else { |
65 | 65 | $uriPath = urldecode( |
66 | - parse_url($_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH) |
|
66 | + parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) |
|
67 | 67 | ); |
68 | 68 | |
69 | 69 | $uriPathParts = explode('public/', $uriPath); |
@@ -233,12 +233,12 @@ discard block |
||
233 | 233 | presenter()->page->setFile($pageFilePath); |
234 | 234 | } else { |
235 | 235 | $pageFilePath = str_replace('.phtml', DIRECTORY_SEPARATOR . 'index.phtml', $pageFilePath); |
236 | - if(is_file($pageFilePath)) { |
|
236 | + if (is_file($pageFilePath)) { |
|
237 | 237 | presenter()->page->setFile($pageFilePath); |
238 | 238 | } |
239 | 239 | } |
240 | 240 | |
241 | - if(presenter()->page->file instanceof SplFileInfo) { |
|
241 | + if (presenter()->page->file instanceof SplFileInfo) { |
|
242 | 242 | $this->setController( |
243 | 243 | (new KernelControllerDataStructure($controllerClassName)) |
244 | 244 | ->setRequestMethod('index') |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | if (class_exists($controllerClassName)) { |
316 | 316 | $this->addresses->any( |
317 | 317 | '/', |
318 | - function () use ($controllerClassName) { |
|
318 | + function() use ($controllerClassName) { |
|
319 | 319 | return new $controllerClassName(); |
320 | 320 | } |
321 | 321 | ); |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | if (class_exists($controllerClassName)) { |
331 | 331 | $this->addresses->any( |
332 | 332 | '/', |
333 | - function () use ($controllerClassName) { |
|
333 | + function() use ($controllerClassName) { |
|
334 | 334 | return new $controllerClassName(); |
335 | 335 | } |
336 | 336 | ); |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | ); |
383 | 383 | } elseif (preg_match("/([a-zA-Z0-9\\\]+)(@)([a-zA-Z0-9\\\]+)/", $closure, $matches)) { |
384 | 384 | $this->setController( |
385 | - (new KernelControllerDataStructure($matches[ 1 ])) |
|
386 | - ->setRequestMethod($matches[ 3 ]), |
|
385 | + (new KernelControllerDataStructure($matches[1])) |
|
386 | + ->setRequestMethod($matches[3]), |
|
387 | 387 | $uriSegments |
388 | 388 | ); |
389 | 389 | } elseif (presenter()->theme->use === true) { |
@@ -70,7 +70,7 @@ |
||
70 | 70 | $download = false; |
71 | 71 | if (false !== ($key = array_search('download', $segments))) { |
72 | 72 | $download = true; |
73 | - unset($segments[ $key ]); |
|
73 | + unset($segments[$key]); |
|
74 | 74 | $segments = array_values($segments); |
75 | 75 | } |
76 | 76 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | */ |
33 | 33 | public function index() |
34 | 34 | { |
35 | - if($this->presenter->page->file instanceof SplFileInfo) { |
|
35 | + if ($this->presenter->page->file instanceof SplFileInfo) { |
|
36 | 36 | $this->view->page(presenter()->page->file->getRealPath()); |
37 | 37 | } |
38 | 38 | } |
@@ -155,12 +155,12 @@ |
||
155 | 155 | $properties = file_get_contents($propertiesFilePath); |
156 | 156 | $properties = json_decode($properties, true); |
157 | 157 | |
158 | - if (isset($properties[ 'vars' ])) { |
|
159 | - $this->vars = $properties[ 'vars' ]; |
|
158 | + if (isset($properties['vars'])) { |
|
159 | + $this->vars = $properties['vars']; |
|
160 | 160 | } |
161 | 161 | |
162 | - if (isset($properties[ 'presets' ])) { |
|
163 | - $this->presets = new SplArrayObject($properties[ 'presets' ]); |
|
162 | + if (isset($properties['presets'])) { |
|
163 | + $this->presets = new SplArrayObject($properties['presets']); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $jsVersion = $this->getVersion($js); |
64 | 64 | $output[] = '<script type="text/javascript" src="' . $this->getUrl($js) . '?v=' . $jsVersion . '"></script>'; |
65 | 65 | } else { |
66 | - $bundleJsMap[ 'sources' ][] = $js; |
|
66 | + $bundleJsMap['sources'][] = $js; |
|
67 | 67 | $bundleJsContents[] = file_get_contents($js); |
68 | 68 | } |
69 | 69 | } |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | // Bundled Js |
72 | 72 | $bundleJsVersion = $this->getVersion(serialize($bundleJsContents)); |
73 | 73 | |
74 | - if(presenter()->page->file instanceof \SplFileInfo) { |
|
75 | - if(presenter()->page->file->getFilename() === 'index') { |
|
74 | + if (presenter()->page->file instanceof \SplFileInfo) { |
|
75 | + if (presenter()->page->file->getFilename() === 'index') { |
|
76 | 76 | $bundleJsFilename = 'body-' . presenter()->page->file->getDirectoryInfo()->getDirName(); |
77 | 77 | } else { |
78 | 78 | $bundleJsFilename = 'body-' . presenter()->page->file->getDirectoryInfo()->getDirName() . '-' . presenter()->page->file->getFilename(); |
79 | 79 | } |
80 | - } elseif(services()->has('controller')) { |
|
80 | + } elseif (services()->has('controller')) { |
|
81 | 81 | $bundleJsFilename = 'body-' . controller()->getParameter(); |
82 | 82 | |
83 | - if(controller()->getRequestMethod() !== 'index') { |
|
84 | - $bundleJsFilename.= '-' . controller()->getRequestMethod(); |
|
83 | + if (controller()->getRequestMethod() !== 'index') { |
|
84 | + $bundleJsFilename .= '-' . controller()->getRequestMethod(); |
|
85 | 85 | } |
86 | 86 | } else { |
87 | 87 | $bundleJsFilename = 'body-' . md5($bundleJsVersion); |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | if (is_file($bundleJsFilePath . '.map')) { |
95 | 95 | $bundleJsMap = json_decode(file_get_contents($bundleJsFilePath . '.map'), true); |
96 | 96 | // if the file version is changed delete it first |
97 | - if ( ! hash_equals($bundleJsVersion, $bundleJsMap[ 'version' ])) { |
|
97 | + if ( ! hash_equals($bundleJsVersion, $bundleJsMap['version'])) { |
|
98 | 98 | unlink($bundleJsFilePath); |
99 | 99 | unlink($bundleJsFilePath . '.map'); |
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | 103 | if ( ! is_file($bundleJsFilePath)) { |
104 | - $bundleJsMap[ 'version' ] = $bundleJsVersion; |
|
104 | + $bundleJsMap['version'] = $bundleJsVersion; |
|
105 | 105 | |
106 | 106 | // Create css file |
107 | 107 | if (count($bundleJsContents)) { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | - if(is_file($bundleJsFilePath)) { |
|
131 | + if (is_file($bundleJsFilePath)) { |
|
132 | 132 | if (input()->env('DEBUG_STAGE') === 'PRODUCTION') { |
133 | 133 | $output[] = '<script type="text/javascript" src="' . $this->getUrl($bundleJsMinifyFilePath) . '?v=' . $bundleJsVersion . '"></script>'; |
134 | 134 | } else { |