@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | public function index() : \Psr\Http\Message\ResponseInterface |
61 | 61 | { |
62 | 62 | $params = $this->request->getQueryParams(); |
63 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
64 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
63 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
64 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
65 | 65 | |
66 | 66 | $categories = $this->categoryService->getPagination($page, $limit); |
67 | 67 | |
68 | - return new HtmlResponse($this->template->render('category::index/index', ['list' => $categories, 'layout' => 'layout/admin'])); |
|
68 | + return new HtmlResponse($this->template->render('category::index/index', [ 'list' => $categories, 'layout' => 'layout/admin' ])); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return \Psr\Http\Message\ResponseInterface |
75 | 75 | */ |
76 | - public function edit($errors = []): \Psr\Http\Message\ResponseInterface |
|
76 | + public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface |
|
77 | 77 | { |
78 | 78 | $id = $this->request->getAttribute('id'); |
79 | 79 | $category = $this->categoryService->getCategory($id); |
80 | 80 | |
81 | - if($this->request->getParsedBody()) { |
|
82 | - $category = (object)($this->request->getParsedBody() + (array)$category); |
|
81 | + if ($this->request->getParsedBody()) { |
|
82 | + $category = (object) ($this->request->getParsedBody() + (array) $category); |
|
83 | 83 | $category->category_id = $id; |
84 | 84 | } |
85 | 85 | |
@@ -96,37 +96,37 @@ discard block |
||
96 | 96 | |
97 | 97 | public function save() |
98 | 98 | { |
99 | - try{ |
|
99 | + try { |
|
100 | 100 | $id = $this->request->getAttribute('id'); |
101 | 101 | $data = $this->request->getParsedBody(); |
102 | 102 | $data += (new Request())->getFiles()->toArray(); |
103 | 103 | |
104 | - if($id) { |
|
104 | + if ($id) { |
|
105 | 105 | $this->categoryService->updateCategory($data, $id); |
106 | 106 | } |
107 | - else{ |
|
107 | + else { |
|
108 | 108 | $this->categoryService->createCategory($data); |
109 | 109 | } |
110 | 110 | |
111 | 111 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories')); |
112 | 112 | } |
113 | - catch(FilterException $fe){ |
|
113 | + catch (FilterException $fe) { |
|
114 | 114 | return $this->edit($fe->getArrayMessages()); |
115 | 115 | } |
116 | - catch(\Exception $e){ |
|
116 | + catch (\Exception $e) { |
|
117 | 117 | throw $e; |
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | 121 | public function delete() |
122 | 122 | { |
123 | - try{ |
|
123 | + try { |
|
124 | 124 | $id = $this->request->getAttribute('id'); |
125 | 125 | $this->categoryService->delete($id); |
126 | 126 | |
127 | 127 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories')); |
128 | 128 | } |
129 | - catch(\Exception $e){ |
|
129 | + catch (\Exception $e) { |
|
130 | 130 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories')); |
131 | 131 | } |
132 | 132 | } |
@@ -12,17 +12,17 @@ discard block |
||
12 | 12 | |
13 | 13 | public function getInputFilter() |
14 | 14 | { |
15 | - if(!$this->inputFilter) { |
|
15 | + if (!$this->inputFilter) { |
|
16 | 16 | $inputFilter = new InputFilter(); |
17 | 17 | |
18 | 18 | $inputFilter->add( |
19 | 19 | [ |
20 | 20 | 'name' => 'name', |
21 | 21 | 'required' => true, |
22 | - 'filters' => [['name' => 'StringTrim']], |
|
22 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
23 | 23 | 'validators' => [ |
24 | - ['name' => 'NotEmpty'], |
|
25 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 500]], |
|
24 | + [ 'name' => 'NotEmpty' ], |
|
25 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 500 ] ], |
|
26 | 26 | ], |
27 | 27 | ] |
28 | 28 | ); |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | [ |
32 | 32 | 'name' => 'slug', |
33 | 33 | 'required' => true, |
34 | - 'filters' => [['name' => 'StringTrim', 'options' => ['charlist' => '/']]], |
|
34 | + 'filters' => [ [ 'name' => 'StringTrim', 'options' => [ 'charlist' => '/' ] ] ], |
|
35 | 35 | 'validators' => [ |
36 | - ['name' => 'NotEmpty'], |
|
37 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
36 | + [ 'name' => 'NotEmpty' ], |
|
37 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
38 | 38 | ], |
39 | 39 | ] |
40 | 40 | ); |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | [ |
44 | 44 | 'name' => 'title', |
45 | 45 | 'required' => false, |
46 | - 'filters' => [['name' => 'StringTrim']], |
|
46 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
47 | 47 | 'validators' => [ |
48 | - ['name' => 'NotEmpty'], |
|
49 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
48 | + [ 'name' => 'NotEmpty' ], |
|
49 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
50 | 50 | ], |
51 | 51 | ] |
52 | 52 | ); |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | [ |
56 | 56 | 'name' => 'description', |
57 | 57 | 'required' => false, |
58 | - 'filters' => [['name' => 'StringTrim']], |
|
58 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
59 | 59 | 'validators' => [ |
60 | - ['name' => 'NotEmpty'], |
|
61 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 1000]], |
|
60 | + [ 'name' => 'NotEmpty' ], |
|
61 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 1000 ] ], |
|
62 | 62 | ], |
63 | 63 | ] |
64 | 64 | ); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | [ |
68 | 68 | 'name' => 'is_in_homepage', |
69 | 69 | 'required' => false, |
70 | - 'filters' => [['name' => 'Boolean']], |
|
70 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
71 | 71 | ] |
72 | 72 | ); |
73 | 73 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | [ |
76 | 76 | 'name' => 'is_in_category_list', |
77 | 77 | 'required' => false, |
78 | - 'filters' => [['name' => 'Boolean']], |
|
78 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
79 | 79 | ] |
80 | 80 | ); |
81 | 81 |
@@ -35,6 +35,6 @@ |
||
35 | 35 | |
36 | 36 | public function getActivePage($urlSlug) |
37 | 37 | { |
38 | - return $this->select(['slug' => $urlSlug, 'is_active' => true]); |
|
38 | + return $this->select([ 'slug' => $urlSlug, 'is_active' => true ]); |
|
39 | 39 | } |
40 | 40 | } |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | public function index(): HtmlResponse |
56 | 56 | { |
57 | 57 | $params = $this->request->getQueryParams(); |
58 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
59 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
58 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
59 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
60 | 60 | $pagination = $this->pageService->getPagination($page, $limit); |
61 | 61 | |
62 | 62 | return new HtmlResponse( |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | ); |
70 | 70 | } |
71 | 71 | |
72 | - public function edit($errors = []): HtmlResponse |
|
72 | + public function edit($errors = [ ]): HtmlResponse |
|
73 | 73 | { |
74 | 74 | $id = $this->request->getAttribute('id'); |
75 | 75 | $page = $this->pageService->getPage($id); |
76 | 76 | |
77 | - if($this->request->getParsedBody()) { |
|
77 | + if ($this->request->getParsedBody()) { |
|
78 | 78 | $page = new \Page\Entity\Page(); |
79 | - $page->exchangeArray($this->request->getParsedBody() + (array)$page); |
|
79 | + $page->exchangeArray($this->request->getParsedBody() + (array) $page); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | return new HtmlResponse( |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | try { |
96 | 96 | $pageId = $this->request->getAttribute('id'); |
97 | 97 | $data = $this->request->getParsedBody(); |
98 | - $data += (new Request())->getFiles()->toArray(); |
|
98 | + $data += (new Request())->getFiles()->toArray(); |
|
99 | 99 | |
100 | - if($pageId) { |
|
100 | + if ($pageId) { |
|
101 | 101 | $this->pageService->updatePage($data, $pageId); |
102 | 102 | } |
103 | 103 | else { |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | |
107 | 107 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages')); |
108 | 108 | } |
109 | - catch(FilterException $fe) { |
|
109 | + catch (FilterException $fe) { |
|
110 | 110 | return $this->edit($fe->getArrayMessages()); |
111 | 111 | } |
112 | - catch(\Exception $e) { |
|
112 | + catch (\Exception $e) { |
|
113 | 113 | throw $e; |
114 | 114 | } |
115 | 115 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages')); |
124 | 124 | } |
125 | - catch(\Exception $e) { |
|
125 | + catch (\Exception $e) { |
|
126 | 126 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages')); |
127 | 127 | } |
128 | 128 | } |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | [ |
19 | 19 | 'name' => 'title', |
20 | 20 | 'required' => true, |
21 | - 'filters' => [['name' => 'StringTrim']], |
|
21 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
22 | 22 | 'validators' => [ |
23 | - ['name' => 'NotEmpty'], |
|
24 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
23 | + [ 'name' => 'NotEmpty' ], |
|
24 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
25 | 25 | ], |
26 | 26 | ] |
27 | 27 | ); |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | [ |
31 | 31 | 'name' => 'slug', |
32 | 32 | 'required' => true, |
33 | - 'filters' => [['name' => 'StringTrim']], |
|
33 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
34 | 34 | 'validators' => [ |
35 | - ['name' => 'NotEmpty'], |
|
36 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
35 | + [ 'name' => 'NotEmpty' ], |
|
36 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
37 | 37 | ], |
38 | 38 | ] |
39 | 39 | ); |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | [ |
43 | 43 | 'name' => 'body', |
44 | 44 | 'required' => true, |
45 | - 'filters' => [['name' => 'StringTrim']], |
|
45 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
46 | 46 | 'validators' => [ |
47 | - ['name' => 'NotEmpty'], |
|
48 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100000]], |
|
47 | + [ 'name' => 'NotEmpty' ], |
|
48 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100000 ] ], |
|
49 | 49 | ], |
50 | 50 | ] |
51 | 51 | ); |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | [ |
55 | 55 | 'name' => 'description', |
56 | 56 | 'required' => true, |
57 | - 'filters' => [['name' => 'StringTrim']], |
|
57 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
58 | 58 | 'validators' => [ |
59 | - ['name' => 'NotEmpty'], |
|
60 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 50000]], |
|
59 | + [ 'name' => 'NotEmpty' ], |
|
60 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 50000 ] ], |
|
61 | 61 | ], |
62 | 62 | ] |
63 | 63 | ); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | [ |
67 | 67 | 'name' => 'has_layout', |
68 | 68 | 'required' => false, |
69 | - 'filters' => [['name' => 'Boolean']], |
|
69 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
70 | 70 | ] |
71 | 71 | ); |
72 | 72 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | [ |
75 | 75 | 'name' => 'is_homepage', |
76 | 76 | 'required' => false, |
77 | - 'filters' => [['name' => 'Boolean']], |
|
77 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
78 | 78 | ] |
79 | 79 | ); |
80 | 80 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | [ |
83 | 83 | 'name' => 'is_active', |
84 | 84 | 'required' => false, |
85 | - 'filters' => [['name' => 'Boolean']], |
|
85 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
86 | 86 | ] |
87 | 87 | ); |
88 | 88 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | [ |
91 | 91 | 'name' => 'is_wysiwyg_editor', |
92 | 92 | 'required' => false, |
93 | - 'filters' => [['name' => 'Boolean']], |
|
93 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
94 | 94 | ] |
95 | 95 | ); |
96 | 96 |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | </div> |
8 | 8 | </div> |
9 | 9 | <div class="col-sm-7"> |
10 | - <?php if($this->pageCount > 1) : ?> |
|
10 | + <?php if ($this->pageCount > 1) : ?> |
|
11 | 11 | <div class="pull-right"> |
12 | 12 | <ul class="pagination" style="margin:0px;"> |
13 | 13 | <!-- Previous page link --> |
14 | - <?php if(isset($this->previous)) : ?> |
|
14 | + <?php if (isset($this->previous)) : ?> |
|
15 | 15 | <li> |
16 | - <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : []); ?>?page=<?php echo $this->previous; ?>"> |
|
16 | + <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : [ ]); ?>?page=<?php echo $this->previous; ?>"> |
|
17 | 17 | <span class="glyphicon glyphicon-chevron-left"></span> |
18 | 18 | </a> |
19 | 19 | </li> |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | <?php endif; ?> |
27 | 27 | |
28 | 28 | <!-- Numbered page links --> |
29 | - <?php foreach($this->pagesInRange as $page): ?> |
|
30 | - <?php if($page != $this->current) : ?> |
|
29 | + <?php foreach ($this->pagesInRange as $page): ?> |
|
30 | + <?php if ($page != $this->current) : ?> |
|
31 | 31 | <li> |
32 | - <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : []); ?>?page=<?php echo $page; ?>"> |
|
32 | + <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : [ ]); ?>?page=<?php echo $page; ?>"> |
|
33 | 33 | <?php echo $page; ?> |
34 | 34 | </a> |
35 | 35 | </li> |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | <?php endforeach; ?> |
42 | 42 | |
43 | 43 | <!-- Next page link --> |
44 | - <?php if(isset($this->next)) : ?> |
|
44 | + <?php if (isset($this->next)) : ?> |
|
45 | 45 | <li> |
46 | - <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : []); ?>?page=<?php echo $this->next; ?>"> |
|
46 | + <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : [ ]); ?>?page=<?php echo $this->next; ?>"> |
|
47 | 47 | <span class="glyphicon glyphicon-chevron-right"></span> |
48 | 48 | </a> |
49 | 49 | </li> |
@@ -14,8 +14,8 @@ |
||
14 | 14 | public function __invoke(ContainerInterface $container) |
15 | 15 | { |
16 | 16 | |
17 | - $config = $container->get('config')['upload']; |
|
18 | - $upload = new Upload($config['public_path'], $config['non_public_path']); |
|
17 | + $config = $container->get('config')[ 'upload' ]; |
|
18 | + $upload = new Upload($config[ 'public_path' ], $config[ 'non_public_path' ]); |
|
19 | 19 | |
20 | 20 | // Create pagination object |
21 | 21 | $pageMapper = $container->get(PageMapper::class); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Web\Action; |
6 | 6 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $page = $this->pageService->getHomepage(); |
60 | 60 | |
61 | - return new HtmlResponse($this->template->render('web::home', ['page' => $page, 'layout' => 'layout/web'])); |
|
61 | + return new HtmlResponse($this->template->render('web::home', [ 'page' => $page, 'layout' => 'layout/web' ])); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | if (!$user) { |
55 | 55 | return $response->withStatus(302)->withHeader( |
56 | 56 | 'Location', |
57 | - $this->router->generateUri('auth', ['action' => 'login']) |
|
57 | + $this->router->generateUri('auth', [ 'action' => 'login' ]) |
|
58 | 58 | ); |
59 | 59 | } |
60 | 60 |