@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | $logContent = ''; |
72 | 72 | |
73 | 73 | // initialize when no submit anymore |
74 | - $data = []; |
|
75 | - $data['logmessage'] = $this->form->get('logmessage')->getValue(); |
|
74 | + $data = [ ]; |
|
75 | + $data[ 'logmessage' ] = $this->form->get('logmessage')->getValue(); |
|
76 | 76 | if ($request->isPost()) { |
77 | 77 | $this->form->setData($request->getPost()); |
78 | 78 | if ($this->form->isValid()) { |
79 | 79 | $data = $this->form->getData(); |
80 | 80 | |
81 | - $this->loggerPriority = $data['logpriority']; |
|
82 | - if ($data['logformat'] !== 'simple') { |
|
83 | - $this->loggerConfig['writers'][0]['options']['formatter']['name'] = $data['logformat']; |
|
84 | - unset($this->loggerConfig['writers'][0]['options']['formatter']['options']); |
|
81 | + $this->loggerPriority = $data[ 'logpriority' ]; |
|
82 | + if ($data[ 'logformat' ] !== 'simple') { |
|
83 | + $this->loggerConfig[ 'writers' ][ 0 ][ 'options' ][ 'formatter' ][ 'name' ] = $data[ 'logformat' ]; |
|
84 | + unset($this->loggerConfig[ 'writers' ][ 0 ][ 'options' ][ 'formatter' ][ 'options' ]); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | // save log data to buffer and make it variable |
92 | 92 | ob_start(); |
93 | - $logger->log((int) $this->loggerPriority, $data['logmessage']); |
|
93 | + $logger->log((int) $this->loggerPriority, $data[ 'logmessage' ]); |
|
94 | 94 | $logContent = ob_get_clean(); |
95 | 95 | |
96 | 96 | return new ViewModel([ |
@@ -28,7 +28,7 @@ |
||
28 | 28 | // Paginate filtered data |
29 | 29 | $paginator = new Paginator(new ArrayAdapter($data)); |
30 | 30 | $paginator->setCurrentPageNumber($page) |
31 | - ->setItemCountPerPage(self::ITEM_PER_PAGE); |
|
31 | + ->setItemCountPerPage(self::ITEM_PER_PAGE); |
|
32 | 32 | |
33 | 33 | return new ViewModel(array_merge($this->params()->fromQuery(), ['paginator' => $paginator])); |
34 | 34 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $paginator->setCurrentPageNumber($page) |
31 | 31 | ->setItemCountPerPage(self::ITEM_PER_PAGE); |
32 | 32 | |
33 | - return new ViewModel(array_merge($this->params()->fromQuery(), ['paginator' => $paginator])); |
|
33 | + return new ViewModel(array_merge($this->params()->fromQuery(), [ 'paginator' => $paginator ])); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | { |
41 | 41 | // Filter by category |
42 | 42 | $category = $this->params()->fromQuery('category', ''); |
43 | - $data = array_key_exists($category, $this->data) ? $this->data[$category] : array_merge( |
|
44 | - $this->data['movies'], |
|
45 | - $this->data['books'], |
|
46 | - $this->data['music'] |
|
43 | + $data = array_key_exists($category, $this->data) ? $this->data[ $category ] : array_merge( |
|
44 | + $this->data[ 'movies' ], |
|
45 | + $this->data[ 'books' ], |
|
46 | + $this->data[ 'music' ] |
|
47 | 47 | ); |
48 | 48 | |
49 | 49 | // Filter by keyword |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | |
55 | 55 | // Remove those elements which doesn't accomplish the keyword condition |
56 | 56 | foreach ($data as $key => $element) { |
57 | - if (!$this->isKeywordInTitle($keyword, $element['title'])) { |
|
58 | - unset($data[$key]); |
|
57 | + if (!$this->isKeywordInTitle($keyword, $element[ 'title' ])) { |
|
58 | + unset($data[ $key ]); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 |
@@ -19,6 +19,6 @@ |
||
19 | 19 | { |
20 | 20 | $config = $serviceLocator->getServiceLocator()->get('Config'); |
21 | 21 | |
22 | - return new IndexController(isset($config['pagination_data']) ? $config['pagination_data'] : []); |
|
22 | + return new IndexController(isset($config[ 'pagination_data' ]) ? $config[ 'pagination_data' ] : [ ]); |
|
23 | 23 | } |
24 | 24 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $this->request = $request; |
39 | 39 | } |
40 | 40 | |
41 | - public function __invoke($name = null, $params = [], $options = [], $reuseMatchedParams = false) |
|
41 | + public function __invoke($name = null, $params = [ ], $options = [ ], $reuseMatchedParams = false) |
|
42 | 42 | { |
43 | 43 | if (null === $this->router) { |
44 | 44 | throw new Exception\RuntimeException('No RouteStackInterface instance provided'); |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | |
47 | 47 | if (3 === func_num_args() && is_bool($options)) { |
48 | 48 | $reuseMatchedParams = $options; |
49 | - $options = []; |
|
49 | + $options = [ ]; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // Inherit query parameters |
53 | 53 | if ($reuseMatchedParams) { |
54 | - $providedQueryParams = isset($options['query']) ? $options['query'] : []; |
|
54 | + $providedQueryParams = isset($options[ 'query' ]) ? $options[ 'query' ] : [ ]; |
|
55 | 55 | $currentQueryParams = $this->request->getQuery()->toArray(); |
56 | - $options['query'] = array_merge($currentQueryParams, $providedQueryParams); |
|
56 | + $options[ 'query' ] = array_merge($currentQueryParams, $providedQueryParams); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return parent::__invoke($name, $params, $options, $reuseMatchedParams); |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | $eventManager = $app->getEventManager(); |
45 | 45 | $sharedEventManager = $eventManager->getSharedManager(); |
46 | 46 | |
47 | - $eventManager->attach('render', [$this,'loadTheme'], 100); |
|
48 | - $sharedEventManager->attach(ReloadService::class, 'reload', [$this, 'reloadConfig'], 100); |
|
47 | + $eventManager->attach('render', [ $this, 'loadTheme' ], 100); |
|
48 | + $sharedEventManager->attach(ReloadService::class, 'reload', [ $this, 'reloadConfig' ], 100); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | $config = $this->service->get('Config'); |
59 | 59 | $this->service->setAllowOverride(true); |
60 | - $config['theme']['name'] = $request->getPost()['themeName']; |
|
60 | + $config[ 'theme' ][ 'name' ] = $request->getPost()[ 'themeName' ]; |
|
61 | 61 | $this->service->setService('Config', $config); |
62 | 62 | $this->service->setAllowOverride(false); |
63 | 63 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | 'reloadService' => 'LearnZF2Themes\Service\ReloadService', |
46 | 46 | ], |
47 | 47 | ], |
48 | - 'theme' => [ |
|
48 | + 'theme' => [ |
|
49 | 49 | 'name' => 'default', |
50 | 50 | ], |
51 | 51 | ]; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * @var array |
32 | 32 | */ |
33 | - private $themesConfig = []; |
|
33 | + private $themesConfig = [ ]; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @var mixed |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param array $themesConfig |
44 | 44 | * @param mixed $reloadService |
45 | 45 | */ |
46 | - public function __construct(array $themesConfig = [], $reloadService) |
|
46 | + public function __construct(array $themesConfig = [ ], $reloadService) |
|
47 | 47 | { |
48 | 48 | $this->themesConfig = $themesConfig; |
49 | 49 | $this->reloadService = $reloadService; |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | if ($request->isPost()) { |
63 | 63 | $filename = __DIR__.'/../../../config/module.config.php'; |
64 | 64 | $settings = include $filename; |
65 | - $themeName = $request->getPost()['themeName']; |
|
66 | - $settings['theme']['name'] = $themeName; |
|
65 | + $themeName = $request->getPost()[ 'themeName' ]; |
|
66 | + $settings[ 'theme' ][ 'name' ] = $themeName; |
|
67 | 67 | file_put_contents($filename, '<?php return '.var_export($settings, true).';'); |
68 | 68 | $this->reloadService->reload(); |
69 | 69 | } |
@@ -33,14 +33,14 @@ |
||
33 | 33 | { |
34 | 34 | $path = __DIR__.'/../../../themes/'; |
35 | 35 | $dir = new DirectoryIterator($path); |
36 | - $themesConfig = []; |
|
36 | + $themesConfig = [ ]; |
|
37 | 37 | |
38 | 38 | foreach ($dir as $file) { |
39 | 39 | if (!$file->isDot()) { |
40 | 40 | $hasConfig = $path.$file->getBasename().'/config/module.config.php'; |
41 | 41 | |
42 | 42 | if (is_file($hasConfig)) { |
43 | - $themesConfig['themes'][$file->getBasename()] = include $hasConfig; |
|
43 | + $themesConfig[ 'themes' ][ $file->getBasename() ] = include $hasConfig; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $config = $serviceLocator->get('Config'); |
36 | 36 | $headScript = $serviceLocator->get('ViewHelperManager')->get('HeadScript'); |
37 | 37 | $headLink = $serviceLocator->get('ViewHelperManager')->get('headLink'); |
38 | - $publicDir = '/themes/'.$config['theme']['name'].DIRECTORY_SEPARATOR; |
|
38 | + $publicDir = '/themes/'.$config[ 'theme' ][ 'name' ].DIRECTORY_SEPARATOR; |
|
39 | 39 | |
40 | 40 | /* |
41 | 41 | * Get theme name from config and load it. |
@@ -44,22 +44,22 @@ discard block |
||
44 | 44 | * from indexAction. |
45 | 45 | */ |
46 | 46 | $viewTemplate = $serviceLocator->get('ViewTemplatePathStack'); |
47 | - $themes = $themesConfig['themes'][$config['theme']['name']]; |
|
47 | + $themes = $themesConfig[ 'themes' ][ $config[ 'theme' ][ 'name' ] ]; |
|
48 | 48 | |
49 | - if (isset($themes['template_path_stack'])) { |
|
50 | - $viewTemplate->addPaths($themes['template_path_stack']); |
|
49 | + if (isset($themes[ 'template_path_stack' ])) { |
|
50 | + $viewTemplate->addPaths($themes[ 'template_path_stack' ]); |
|
51 | 51 | } |
52 | 52 | |
53 | - if (isset($themes['template_map'])) { |
|
53 | + if (isset($themes[ 'template_map' ])) { |
|
54 | 54 | $viewTemplate = $serviceLocator->get('ViewTemplateMapResolver'); |
55 | - $viewTemplate->merge($themes['template_map']); |
|
55 | + $viewTemplate->merge($themes[ 'template_map' ]); |
|
56 | 56 | } |
57 | 57 | |
58 | - foreach ($themes['css'] as $key => $file) { |
|
58 | + foreach ($themes[ 'css' ] as $key => $file) { |
|
59 | 59 | $headLink->prependStylesheet($publicDir.$file); |
60 | 60 | } |
61 | 61 | |
62 | - foreach ($themes['js'] as $key => $file) { |
|
62 | + foreach ($themes[ 'js' ] as $key => $file) { |
|
63 | 63 | $headScript->prependFile($publicDir.$file); |
64 | 64 | } |
65 | 65 |