@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | } else { |
79 | 79 | $uriPath = urldecode( |
80 | - parse_url($_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH) |
|
80 | + parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | $uriPathParts = explode('public/', $uriPath); |
@@ -120,20 +120,20 @@ discard block |
||
120 | 120 | // Module routing |
121 | 121 | if ($numOfUriSegments = count($uriSegments)) { |
122 | 122 | if (empty($app)) { |
123 | - if (false !== ($module = modules()->getModule( reset($uriSegments) ))) { |
|
123 | + if (false !== ($module = modules()->getModule(reset($uriSegments)))) { |
|
124 | 124 | //array_shift($uriSegments); |
125 | 125 | $this->uri = $this->uri->withSegments(new KernelMessageUriSegments($uriSegments)); |
126 | 126 | $uriString = $this->uri->getSegments()->getString(); |
127 | 127 | |
128 | 128 | $this->registerModule($module); |
129 | 129 | } |
130 | - } elseif (false !== ($module = modules()->getModule( [$app->getParameter(), 'modules', reset($uriSegments) ] ))) { |
|
130 | + } elseif (false !== ($module = modules()->getModule([$app->getParameter(), 'modules', reset($uriSegments)]))) { |
|
131 | 131 | array_shift($uriSegments); |
132 | 132 | $this->uri = $this->uri->withSegments(new KernelMessageUriSegments($uriSegments)); |
133 | 133 | $uriString = $this->uri->getSegments()->getString(); |
134 | 134 | |
135 | 135 | $this->registerModule($module); |
136 | - } elseif (false !== ($module = modules()->getModule( [$app->getParameter(), 'plugins', reset($uriSegments) ] ))) { |
|
136 | + } elseif (false !== ($module = modules()->getModule([$app->getParameter(), 'plugins', reset($uriSegments)]))) { |
|
137 | 137 | array_shift($uriSegments); |
138 | 138 | $this->uri = $this->uri->withSegments(new KernelMessageUriSegments($uriSegments)); |
139 | 139 | $uriString = $this->uri->getSegments()->getString(); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $this->registerModule($module); |
142 | 142 | } |
143 | 143 | |
144 | - if($numOfUriSegments = count($uriSegments)) { |
|
144 | + if ($numOfUriSegments = count($uriSegments)) { |
|
145 | 145 | for ($i = 0; $i <= $numOfUriSegments; $i++) { |
146 | 146 | $uriRoutedSegments = array_diff($uriSegments, |
147 | 147 | array_slice($uriSegments, ($numOfUriSegments - $i))); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | if (class_exists($controllerClassName = $controllerNamespace . implode('\\', |
233 | 233 | array_map('studlycase', $uriRoutedSegments)))) { |
234 | 234 | |
235 | - if($controllerClassName::$inherited) { |
|
235 | + if ($controllerClassName::$inherited) { |
|
236 | 236 | $uriSegments = array_diff($uriSegments, $uriRoutedSegments); |
237 | 237 | $this->setController(new KernelControllerDataStructure($controllerClassName), |
238 | 238 | $uriSegments); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * Try to find requested page |
250 | 250 | */ |
251 | 251 | if (false !== ($pagesDir = $module->getResourcesDir('pages', true))) { |
252 | - if($controllerClassName = $this->getPagesControllerClassName()) { |
|
252 | + if ($controllerClassName = $this->getPagesControllerClassName()) { |
|
253 | 253 | |
254 | 254 | /** |
255 | 255 | * Try to find from database |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * Try to find from page file |
279 | 279 | */ |
280 | 280 | |
281 | - foreach(['.phtml', '.vue'] as $pageExtension) { |
|
281 | + foreach (['.phtml', '.vue'] as $pageExtension) { |
|
282 | 282 | $pageFilePath = $pagesDir . implode(DIRECTORY_SEPARATOR, |
283 | 283 | array_map('dash', $uriRoutedSegments)) . $pageExtension; |
284 | 284 | |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | break; |
288 | 288 | } else { |
289 | 289 | $pageFilePath = str_replace($pageExtension, DIRECTORY_SEPARATOR . 'index' . $pageExtension, $pageFilePath); |
290 | - if(is_file($pageFilePath)) { |
|
290 | + if (is_file($pageFilePath)) { |
|
291 | 291 | presenter()->page->setFile($pageFilePath); |
292 | 292 | break; |
293 | 293 | } |
294 | 294 | } |
295 | 295 | } |
296 | 296 | |
297 | - if(presenter()->page->file instanceof SplFileInfo) { |
|
297 | + if (presenter()->page->file instanceof SplFileInfo) { |
|
298 | 298 | $this->setController( |
299 | 299 | (new KernelControllerDataStructure($controllerClassName)) |
300 | 300 | ->setRequestMethod('index') |
@@ -337,19 +337,19 @@ discard block |
||
337 | 337 | { |
338 | 338 | $modules = modules()->getArrayCopy(); |
339 | 339 | |
340 | - foreach($modules as $module) { |
|
340 | + foreach ($modules as $module) { |
|
341 | 341 | $controllerClassName = $module->getNamespace() . 'Controllers\Pages'; |
342 | 342 | if ($module->getNamespace() === 'O2System\Framework\\') { |
343 | 343 | $controllerClassName = 'O2System\Framework\Http\Controllers\Pages'; |
344 | 344 | } |
345 | 345 | |
346 | - if(class_exists($controllerClassName)) { |
|
346 | + if (class_exists($controllerClassName)) { |
|
347 | 347 | return $controllerClassName; |
348 | 348 | break; |
349 | 349 | } |
350 | 350 | } |
351 | 351 | |
352 | - if(class_exists('O2System\Framework\Http\Controllers\Pages')) { |
|
352 | + if (class_exists('O2System\Framework\Http\Controllers\Pages')) { |
|
353 | 353 | return 'O2System\Framework\Http\Controllers\Pages'; |
354 | 354 | } |
355 | 355 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | if (class_exists($controllerClassName)) { |
401 | 401 | $this->addresses->any( |
402 | 402 | '/', |
403 | - function () use ($controllerClassName) { |
|
403 | + function() use ($controllerClassName) { |
|
404 | 404 | return new $controllerClassName(); |
405 | 405 | } |
406 | 406 | ); |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | if (class_exists($controllerClassName)) { |
416 | 416 | $this->addresses->any( |
417 | 417 | '/', |
418 | - function () use ($controllerClassName) { |
|
418 | + function() use ($controllerClassName) { |
|
419 | 419 | return new $controllerClassName(); |
420 | 420 | } |
421 | 421 | ); |
@@ -467,8 +467,8 @@ discard block |
||
467 | 467 | ); |
468 | 468 | } elseif (preg_match("/([a-zA-Z0-9\\\]+)(@)([a-zA-Z0-9\\\]+)/", $closure, $matches)) { |
469 | 469 | $this->setController( |
470 | - (new KernelControllerDataStructure($matches[ 1 ])) |
|
471 | - ->setRequestMethod($matches[ 3 ]), |
|
470 | + (new KernelControllerDataStructure($matches[1])) |
|
471 | + ->setRequestMethod($matches[3]), |
|
472 | 472 | $uriSegments |
473 | 473 | ); |
474 | 474 | } elseif (presenter()->theme->use === true) { |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | |
204 | 204 | if (isset($config) AND is_array($config)) { |
205 | 205 | // Set default timezone |
206 | - if (isset($config[ 'datetime' ][ 'timezone' ])) { |
|
207 | - date_default_timezone_set($config[ 'datetime' ][ 'timezone' ]); |
|
206 | + if (isset($config['datetime']['timezone'])) { |
|
207 | + date_default_timezone_set($config['datetime']['timezone']); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | // Setup Language Ideom and Locale |
211 | - if (isset($config[ 'language' ])) { |
|
212 | - language()->setDefault($config[ 'language' ]); |
|
211 | + if (isset($config['language'])) { |
|
212 | + language()->setDefault($config['language']); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | config()->merge($config); |
@@ -372,14 +372,14 @@ discard block |
||
372 | 372 | public function push($module) |
373 | 373 | { |
374 | 374 | if ( ! in_array($module->getNamespace(), ['O2System\Kernel\\', 'O2System\Framework\\', 'App\\'])) { |
375 | - if($module instanceof DataStructures\Module) { |
|
375 | + if ($module instanceof DataStructures\Module) { |
|
376 | 376 | $this->autoload($module); |
377 | 377 | |
378 | 378 | parent::push($module); |
379 | 379 | |
380 | - if($module->getType() === 'APP') { |
|
380 | + if ($module->getType() === 'APP') { |
|
381 | 381 | $this->setActiveApp($module); |
382 | - } elseif(in_array($module->getType(), ['MODULE', 'COMPONENT'])) { |
|
382 | + } elseif (in_array($module->getType(), ['MODULE', 'COMPONENT'])) { |
|
383 | 383 | $this->setActiveModule($module); |
384 | 384 | } |
385 | 385 | } |
@@ -447,8 +447,8 @@ discard block |
||
447 | 447 | $packageJsonFile = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $packageJsonFile); |
448 | 448 | $packageJsonFileInfo = pathinfo($packageJsonFile); |
449 | 449 | |
450 | - if ($packageJsonFileInfo[ 'filename' ] === 'widget' or |
|
451 | - $packageJsonFileInfo[ 'filename' ] === 'language' or |
|
450 | + if ($packageJsonFileInfo['filename'] === 'widget' or |
|
451 | + $packageJsonFileInfo['filename'] === 'language' or |
|
452 | 452 | strpos($packageJsonFile, '.svn') !== false // subversion properties file conflict. |
453 | 453 | ) { |
454 | 454 | continue; |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | } |
479 | 479 | |
480 | 480 | if (strpos($packageJsonFile, |
481 | - $modularType = ucfirst(plural($packageJsonFileInfo[ 'filename' ])) . DIRECTORY_SEPARATOR) === false) { |
|
482 | - $modularType = ucfirst($packageJsonFileInfo[ 'filename' ]) . DIRECTORY_SEPARATOR; |
|
481 | + $modularType = ucfirst(plural($packageJsonFileInfo['filename'])) . DIRECTORY_SEPARATOR) === false) { |
|
482 | + $modularType = ucfirst($packageJsonFileInfo['filename']) . DIRECTORY_SEPARATOR; |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | $modularType = strtolower(rtrim($modularType, DIRECTORY_SEPARATOR)); |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | PATH_PUBLIC, |
495 | 495 | PATH_RESOURCES, |
496 | 496 | PATH_APP, |
497 | - $packageJsonFileInfo[ 'basename' ], |
|
497 | + $packageJsonFileInfo['basename'], |
|
498 | 498 | ], |
499 | 499 | '', |
500 | 500 | $packageJsonFile |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | ) |
504 | 504 | ); |
505 | 505 | |
506 | - $moduleSegments = array_map(function ($string) { |
|
506 | + $moduleSegments = array_map(function($string) { |
|
507 | 507 | return dash(snakecase($string)); |
508 | 508 | }, $moduleSegments); |
509 | 509 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | if (false !== ($segmentKey = array_search($modularType, $moduleSegments))) { |
520 | 520 | $moduleParentSegments = array_slice($moduleSegments, 0, $segmentKey); |
521 | 521 | |
522 | - unset($moduleSegments[ $segmentKey ]); |
|
522 | + unset($moduleSegments[$segmentKey]); |
|
523 | 523 | break; |
524 | 524 | } |
525 | 525 | } |
@@ -530,29 +530,29 @@ discard block |
||
530 | 530 | str_replace( |
531 | 531 | PATH_ROOT, |
532 | 532 | '', |
533 | - $packageJsonFileInfo[ 'dirname' ] |
|
533 | + $packageJsonFileInfo['dirname'] |
|
534 | 534 | ), |
535 | 535 | false |
536 | 536 | ); |
537 | 537 | |
538 | - if (isset($packageJsonMetadata[ 'namespace' ])) { |
|
539 | - $moduleNamespace = $packageJsonMetadata[ 'namespace' ]; |
|
540 | - unset($packageJsonMetadata[ 'namespace' ]); |
|
538 | + if (isset($packageJsonMetadata['namespace'])) { |
|
539 | + $moduleNamespace = $packageJsonMetadata['namespace']; |
|
540 | + unset($packageJsonMetadata['namespace']); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | $registryKey = implode('/', $moduleSegments); |
544 | 544 | |
545 | 545 | if ($registryKey === '') { |
546 | - if ($packageJsonFileInfo[ 'dirname' ] . DIRECTORY_SEPARATOR !== PATH_APP and $modularType === 'app') { |
|
546 | + if ($packageJsonFileInfo['dirname'] . DIRECTORY_SEPARATOR !== PATH_APP and $modularType === 'app') { |
|
547 | 547 | $registryKey = dash(snakecase( |
548 | - pathinfo($packageJsonFileInfo[ 'dirname' ], PATHINFO_FILENAME))); |
|
548 | + pathinfo($packageJsonFileInfo['dirname'], PATHINFO_FILENAME))); |
|
549 | 549 | } |
550 | 550 | } |
551 | 551 | |
552 | - $registry[ $registryKey ] = (new DataStructures\Module( |
|
553 | - $packageJsonFileInfo[ 'dirname' ] |
|
552 | + $registry[$registryKey] = (new DataStructures\Module( |
|
553 | + $packageJsonFileInfo['dirname'] |
|
554 | 554 | )) |
555 | - ->setType($packageJsonFileInfo[ 'filename' ]) |
|
555 | + ->setType($packageJsonFileInfo['filename']) |
|
556 | 556 | ->setNamespace($moduleNamespace) |
557 | 557 | ->setSegments($moduleSegments) |
558 | 558 | ->setParentSegments($moduleParentSegments) |
@@ -714,8 +714,8 @@ discard block |
||
714 | 714 | $segment = dash($segment); |
715 | 715 | |
716 | 716 | if ($this->exists($segment)) { |
717 | - if ($this->registry[ $segment ] instanceof DataStructures\Module) { |
|
718 | - return $this->registry[ $segment ]; |
|
717 | + if ($this->registry[$segment] instanceof DataStructures\Module) { |
|
718 | + return $this->registry[$segment]; |
|
719 | 719 | } |
720 | 720 | } |
721 | 721 | |
@@ -751,8 +751,8 @@ discard block |
||
751 | 751 | */ |
752 | 752 | public function first() |
753 | 753 | { |
754 | - if (isset($this->registry[ '' ])) { |
|
755 | - return $this->registry[ '' ]; |
|
754 | + if (isset($this->registry[''])) { |
|
755 | + return $this->registry['']; |
|
756 | 756 | } elseif (reset($this->registry)->type === 'APP') { |
757 | 757 | return reset($this->registry); |
758 | 758 | } |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | $segments = (is_array($segments) ? implode('/', array_map('dash', $segments)) : $segments); |
775 | 775 | |
776 | 776 | if ($this->exists($segments)) { |
777 | - return $this->registry[ $segments ]; |
|
777 | + return $this->registry[$segments]; |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | return false; |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | |
796 | 796 | foreach ($this as $key => $module) { |
797 | 797 | if ($module instanceof DataStructures\Module) { |
798 | - $namespaces[ $key ] = new SplNamespaceInfo($module->getNamespace(), $module->getRealPath()); |
|
798 | + $namespaces[$key] = new SplNamespaceInfo($module->getNamespace(), $module->getRealPath()); |
|
799 | 799 | } |
800 | 800 | } |
801 | 801 |