@@ -11,8 +11,8 @@ |
||
11 | 11 | { |
12 | 12 | public function __invoke(ContainerInterface $container) |
13 | 13 | { |
14 | - $config = $container->get('config')['upload']; |
|
15 | - $upload = new Upload($config['public_path'], $config['non_public_path']); |
|
14 | + $config = $container->get('config')[ 'upload' ]; |
|
15 | + $upload = new Upload($config[ 'public_path' ], $config[ 'non_public_path' ]); |
|
16 | 16 | |
17 | 17 | return new PageService( |
18 | 18 | $container->get(PageMapper::class), |
@@ -75,17 +75,14 @@ discard block |
||
75 | 75 | |
76 | 76 | if($pageId) { |
77 | 77 | $this->pageService->updatePage($data, $pageId); |
78 | - } |
|
79 | - else { |
|
78 | + } else { |
|
80 | 79 | $this->pageService->createPage($data); |
81 | 80 | } |
82 | 81 | |
83 | 82 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages')); |
84 | - } |
|
85 | - catch(FilterException $fe) { |
|
83 | + } catch(FilterException $fe) { |
|
86 | 84 | return $this->edit($fe->getArrayMessages()); |
87 | - } |
|
88 | - catch(\Exception $e) { |
|
85 | + } catch(\Exception $e) { |
|
89 | 86 | throw $e; |
90 | 87 | } |
91 | 88 | } |
@@ -97,8 +94,7 @@ discard block |
||
97 | 94 | $this->pageService->delete($pageId); |
98 | 95 | |
99 | 96 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages')); |
100 | - } |
|
101 | - catch(\Exception $e) { |
|
97 | + } catch(\Exception $e) { |
|
102 | 98 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages')); |
103 | 99 | } |
104 | 100 | } |
@@ -15,21 +15,21 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * |
17 | 17 | * |
18 | - * @var Template |
|
18 | + * @var Template |
|
19 | 19 | */ |
20 | 20 | private $template; |
21 | 21 | |
22 | 22 | /** |
23 | 23 | * |
24 | 24 | * |
25 | - * @var Router |
|
25 | + * @var Router |
|
26 | 26 | */ |
27 | 27 | private $router; |
28 | 28 | |
29 | 29 | /** |
30 | 30 | * |
31 | 31 | * |
32 | - * @var PageService |
|
32 | + * @var PageService |
|
33 | 33 | */ |
34 | 34 | private $pageService; |
35 | 35 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * |
52 | 52 | * |
53 | - * @return HtmlResponse |
|
53 | + * @return HtmlResponse |
|
54 | 54 | */ |
55 | 55 | public function index(): HtmlResponse |
56 | 56 | { |
@@ -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 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | 'page/pagination' => __DIR__ . '/../templates/partial/pagination.php', |
15 | 15 | ], |
16 | 16 | 'paths' => [ |
17 | - 'page' => [__DIR__ . '/../templates/page'], |
|
17 | + 'page' => [ __DIR__ . '/../templates/page' ], |
|
18 | 18 | ], |
19 | 19 | ], |
20 | 20 | |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | 'name' => 'admin.pages', |
33 | 33 | 'path' => '/admin/pages', |
34 | 34 | 'middleware' => Controller\PageController::class, |
35 | - 'allowed_methods' => ['GET'], |
|
35 | + 'allowed_methods' => [ 'GET' ], |
|
36 | 36 | ], |
37 | 37 | [ |
38 | 38 | 'name' => 'admin.pages.action', |
39 | 39 | 'path' => '/admin/pages/:action/:id', |
40 | 40 | 'middleware' => Controller\PageController::class, |
41 | - 'allowed_methods' => ['GET', 'POST'] |
|
41 | + 'allowed_methods' => [ 'GET', 'POST' ] |
|
42 | 42 | ] |
43 | 43 | ], |
44 | 44 | ]; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function getDescription($limit = null) |
112 | 112 | { |
113 | - if(!$limit) { |
|
113 | + if (!$limit) { |
|
114 | 114 | return $this->description; |
115 | 115 | } |
116 | 116 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function getCreatedAt($format = null) |
167 | 167 | { |
168 | - if(!$format) { |
|
168 | + if (!$format) { |
|
169 | 169 | return $this->created_at; |
170 | 170 | } |
171 | 171 | |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @param array $data |
185 | 185 | */ |
186 | - public function exchangeArray($data = []) |
|
186 | + public function exchangeArray($data = [ ]) |
|
187 | 187 | { |
188 | - foreach(array_keys(get_object_vars($this)) as $property) { |
|
189 | - $this->{$property} = isset($data[$property]) ? $data[$property] : null; |
|
188 | + foreach (array_keys(get_object_vars($this)) as $property) { |
|
189 | + $this->{$property} = isset($data[ $property ]) ? $data[ $property ] : null; |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -194,18 +194,18 @@ discard block |
||
194 | 194 | public function getArrayCopy() |
195 | 195 | { |
196 | 196 | return [ |
197 | - 'page_uuid' => (binary)$this->page_uuid, |
|
198 | - 'page_id' => (string)$this->page_id, |
|
199 | - 'title' => (string)$this->title, |
|
200 | - 'body' => (string)$this->body, |
|
201 | - 'description' => (string)$this->description, |
|
202 | - 'main_img' => (string)$this->main_img, |
|
203 | - 'has_layout' => (boolean)$this->has_layout, |
|
204 | - 'is_homepage' => (boolean)$this->is_homepage, |
|
205 | - 'is_active' => (boolean)$this->is_active, |
|
206 | - 'is_wysiwyg_editor' => (boolean)$this->is_wysiwyg_editor, |
|
207 | - 'created_at' => (string)$this->created_at, |
|
208 | - 'slug' => (string)$this->slug |
|
197 | + 'page_uuid' => (binary) $this->page_uuid, |
|
198 | + 'page_id' => (string) $this->page_id, |
|
199 | + 'title' => (string) $this->title, |
|
200 | + 'body' => (string) $this->body, |
|
201 | + 'description' => (string) $this->description, |
|
202 | + 'main_img' => (string) $this->main_img, |
|
203 | + 'has_layout' => (boolean) $this->has_layout, |
|
204 | + 'is_homepage' => (boolean) $this->is_homepage, |
|
205 | + 'is_active' => (boolean) $this->is_active, |
|
206 | + 'is_wysiwyg_editor' => (boolean) $this->is_wysiwyg_editor, |
|
207 | + 'created_at' => (string) $this->created_at, |
|
208 | + 'slug' => (string) $this->slug |
|
209 | 209 | ]; |
210 | 210 | } |
211 | 211 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * |
38 | 38 | * |
39 | - * @return mixed |
|
39 | + * @return mixed |
|
40 | 40 | */ |
41 | 41 | public function getSlug() |
42 | 42 | { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * |
48 | 48 | * |
49 | - * @param mixed $slug |
|
49 | + * @param mixed $slug |
|
50 | 50 | */ |
51 | 51 | public function setSlug($slug) |
52 | 52 | { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * |
62 | 62 | * |
63 | - * @return mixed |
|
63 | + * @return mixed |
|
64 | 64 | */ |
65 | 65 | public function getIsActive() |
66 | 66 | { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | /** |
71 | 71 | * |
72 | 72 | * |
73 | - * @param mixed $is_active |
|
73 | + * @param mixed $is_active |
|
74 | 74 | */ |
75 | 75 | public function setIsActive($is_active) |
76 | 76 | { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | /** |
81 | 81 | * |
82 | 82 | * |
83 | - * @return binary |
|
83 | + * @return binary |
|
84 | 84 | */ |
85 | 85 | public function getPageUuid() |
86 | 86 | { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | /** |
91 | 91 | * |
92 | 92 | * |
93 | - * @param binary $page_uuid |
|
93 | + * @param binary $page_uuid |
|
94 | 94 | */ |
95 | 95 | public function setPageUuid($page_uuid) |
96 | 96 | { |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | /** |
101 | 101 | * |
102 | 102 | * |
103 | - * @return mixed |
|
103 | + * @return mixed |
|
104 | 104 | */ |
105 | 105 | public function getPageId() |
106 | 106 | { |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | /** |
111 | 111 | * |
112 | 112 | * |
113 | - * @param mixed $page_id |
|
113 | + * @param mixed $page_id |
|
114 | 114 | */ |
115 | 115 | public function setPageId($page_id) |
116 | 116 | { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * |
122 | 122 | * |
123 | - * @return mixed |
|
123 | + * @return mixed |
|
124 | 124 | */ |
125 | 125 | public function getTitle() |
126 | 126 | { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | /** |
131 | 131 | * |
132 | 132 | * |
133 | - * @param mixed $title |
|
133 | + * @param mixed $title |
|
134 | 134 | */ |
135 | 135 | public function setTitle($title) |
136 | 136 | { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | /** |
141 | 141 | * |
142 | 142 | * |
143 | - * @return mixed |
|
143 | + * @return mixed |
|
144 | 144 | */ |
145 | 145 | public function getBody() |
146 | 146 | { |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | /** |
151 | 151 | * |
152 | 152 | * |
153 | - * @param mixed $body |
|
153 | + * @param mixed $body |
|
154 | 154 | */ |
155 | 155 | public function setBody($body) |
156 | 156 | { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | /** |
174 | 174 | * |
175 | 175 | * |
176 | - * @param mixed $description |
|
176 | + * @param mixed $description |
|
177 | 177 | */ |
178 | 178 | public function setDescription($description) |
179 | 179 | { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | /** |
184 | 184 | * |
185 | 185 | * |
186 | - * @return mixed |
|
186 | + * @return mixed |
|
187 | 187 | */ |
188 | 188 | public function getMainImg() |
189 | 189 | { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | /** |
194 | 194 | * |
195 | 195 | * |
196 | - * @param mixed $main_img |
|
196 | + * @param mixed $main_img |
|
197 | 197 | */ |
198 | 198 | public function setMainImg($main_img) |
199 | 199 | { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | /** |
204 | 204 | * |
205 | 205 | * |
206 | - * @return mixed |
|
206 | + * @return mixed |
|
207 | 207 | */ |
208 | 208 | public function getHasLayout() |
209 | 209 | { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | /** |
220 | 220 | * |
221 | 221 | * |
222 | - * @return mixed |
|
222 | + * @return mixed |
|
223 | 223 | */ |
224 | 224 | public function getIsHomepage() |
225 | 225 | { |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | /** |
230 | 230 | * |
231 | 231 | * |
232 | - * @param mixed $is_homepage |
|
232 | + * @param mixed $is_homepage |
|
233 | 233 | */ |
234 | 234 | public function setIsHomepage($is_homepage) |
235 | 235 | { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | /** |
253 | 253 | * |
254 | 254 | * |
255 | - * @param string $created_at |
|
255 | + * @param string $created_at |
|
256 | 256 | */ |
257 | 257 | public function setCreatedAt(string $created_at) |
258 | 258 | { |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | /** |
275 | 275 | * |
276 | 276 | * |
277 | - * @return Array |
|
277 | + * @return Array |
|
278 | 278 | */ |
279 | 279 | public function getArrayCopy() |
280 | 280 | { |
@@ -17,13 +17,16 @@ discard block |
||
17 | 17 | <span class="glyphicon glyphicon-chevron-left"></span> |
18 | 18 | </a> |
19 | 19 | </li> |
20 | - <?php else: ?> |
|
20 | + <?php else { |
|
21 | + : ?> |
|
21 | 22 | <li class="disabled"> |
22 | 23 | <a href="#"> |
23 | 24 | <span class="glyphicon glyphicon-chevron-left"></span> |
24 | 25 | </a> |
25 | 26 | </li> |
26 | - <?php endif; ?> |
|
27 | + <?php endif; |
|
28 | +} |
|
29 | +?> |
|
27 | 30 | |
28 | 31 | <!-- Numbered page links --> |
29 | 32 | <?php foreach($this->pagesInRange as $page): ?> |
@@ -33,9 +36,12 @@ discard block |
||
33 | 36 | <?php echo $page; ?> |
34 | 37 | </a> |
35 | 38 | </li> |
36 | - <?php else: ?> |
|
39 | + <?php else { |
|
40 | + : ?> |
|
37 | 41 | <li class="active"> |
38 | - <a href="#"><?php echo $page; ?></a> |
|
42 | + <a href="#"><?php echo $page; |
|
43 | +} |
|
44 | +?></a> |
|
39 | 45 | </li> |
40 | 46 | <?php endif; ?> |
41 | 47 | <?php endforeach; ?> |
@@ -47,13 +53,16 @@ discard block |
||
47 | 53 | <span class="glyphicon glyphicon-chevron-right"></span> |
48 | 54 | </a> |
49 | 55 | </li> |
50 | - <?php else: ?> |
|
56 | + <?php else { |
|
57 | + : ?> |
|
51 | 58 | <li class="disabled"> |
52 | 59 | <a href="#"> |
53 | 60 | <span class="glyphicon glyphicon-chevron-right"></span> |
54 | 61 | </a> |
55 | 62 | </li> |
56 | - <?php endif; ?> |
|
63 | + <?php endif; |
|
64 | +} |
|
65 | +?> |
|
57 | 66 | </ul> |
58 | 67 | </div> |
59 | 68 | <?php endif; ?> |
@@ -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> |
@@ -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 Admin\Controller; |
6 | 6 | |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | { |
65 | 65 | $user = $this->session->getStorage()->user; |
66 | 66 | $params = $this->request->getQueryParams(); |
67 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
68 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
67 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
68 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
69 | 69 | |
70 | 70 | $adminUsers = $this->adminUserService->getPagination($page, $limit, $user->admin_user_id); |
71 | 71 | |
72 | - return new HtmlResponse($this->template->render('admin::user/index', ['list' => $adminUsers, 'layout' => 'layout/admin'])); |
|
72 | + return new HtmlResponse($this->template->render('admin::user/index', [ 'list' => $adminUsers, 'layout' => 'layout/admin' ])); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return \Psr\Http\Message\ResponseInterface |
79 | 79 | */ |
80 | - public function edit($errors = []): \Psr\Http\Message\ResponseInterface |
|
80 | + public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface |
|
81 | 81 | { |
82 | 82 | $id = $this->request->getAttribute('id'); |
83 | 83 | $user = $this->adminUserService->getUser($id); |
84 | 84 | |
85 | - if($this->request->getParsedBody()) { |
|
86 | - $user = (object)($this->request->getParsedBody() + (array)$user); |
|
85 | + if ($this->request->getParsedBody()) { |
|
86 | + $user = (object) ($this->request->getParsedBody() + (array) $user); |
|
87 | 87 | $user->admin_user_id = $id; |
88 | 88 | } |
89 | 89 | |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | try { |
100 | 100 | $userId = $this->request->getAttribute('id'); |
101 | 101 | $data = $this->request->getParsedBody(); |
102 | - $data += (new Request())->getFiles()->toArray(); |
|
102 | + $data += (new Request())->getFiles()->toArray(); |
|
103 | 103 | |
104 | - if($userId) { |
|
104 | + if ($userId) { |
|
105 | 105 | $this->adminUserService->updateUser($data, $userId); |
106 | 106 | } |
107 | 107 | else { |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | |
111 | 111 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users')); |
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 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users')); |
128 | 128 | } |
129 | - catch(\Exception $e) { |
|
129 | + catch (\Exception $e) { |
|
130 | 130 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users')); |
131 | 131 | } |
132 | 132 | } |
@@ -103,17 +103,14 @@ discard block |
||
103 | 103 | |
104 | 104 | if($userId) { |
105 | 105 | $this->adminUserService->updateUser($data, $userId); |
106 | - } |
|
107 | - else { |
|
106 | + } else { |
|
108 | 107 | $this->adminUserService->registerNewUser($data); |
109 | 108 | } |
110 | 109 | |
111 | 110 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users')); |
112 | - } |
|
113 | - catch(FilterException $fe) { |
|
111 | + } catch(FilterException $fe) { |
|
114 | 112 | return $this->edit($fe->getArrayMessages()); |
115 | - } |
|
116 | - catch(\Exception $e) { |
|
113 | + } catch(\Exception $e) { |
|
117 | 114 | throw $e; |
118 | 115 | } |
119 | 116 | } |
@@ -125,8 +122,7 @@ discard block |
||
125 | 122 | $this->adminUserService->delete($userId); |
126 | 123 | |
127 | 124 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users')); |
128 | - } |
|
129 | - catch(\Exception $e) { |
|
125 | + } catch(\Exception $e) { |
|
130 | 126 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users')); |
131 | 127 | } |
132 | 128 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | 'admin/pagination' => __DIR__ . '/../templates/admin/partial/pagination.phtml', |
14 | 14 | ], |
15 | 15 | 'paths' => [ |
16 | - 'admin' => [__DIR__ . '/../templates/admin'], |
|
16 | + 'admin' => [ __DIR__ . '/../templates/admin' ], |
|
17 | 17 | ], |
18 | 18 | ], |
19 | 19 | |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | 'name' => 'auth', |
31 | 31 | 'path' => '/auth/:action', |
32 | 32 | 'middleware' => Controller\AuthController::class, |
33 | - 'allowed_methods' => ['GET', 'POST'], |
|
33 | + 'allowed_methods' => [ 'GET', 'POST' ], |
|
34 | 34 | ], |
35 | 35 | [ |
36 | 36 | 'name' => 'admin', |
37 | 37 | 'path' => '/admin', |
38 | 38 | 'middleware' => Action\IndexAction::class, |
39 | - 'allowed_methods' => ['GET'], |
|
39 | + 'allowed_methods' => [ 'GET' ], |
|
40 | 40 | ], |
41 | 41 | [ |
42 | 42 | 'name' => 'admin.users', |
43 | 43 | 'path' => '/admin/users', |
44 | 44 | 'middleware' => Controller\UserController::class, |
45 | - 'allowed_methods' => ['GET'] |
|
45 | + 'allowed_methods' => [ 'GET' ] |
|
46 | 46 | ], |
47 | 47 | [ |
48 | 48 | 'name' => 'admin.users.action', |
49 | 49 | 'path' => '/admin/users/:action/:id', |
50 | 50 | 'middleware' => Controller\UserController::class, |
51 | - 'allowed_methods' => ['GET', 'POST'] |
|
51 | + 'allowed_methods' => [ 'GET', 'POST' ] |
|
52 | 52 | ], |
53 | 53 | ], |
54 | 54 |
@@ -39,6 +39,6 @@ |
||
39 | 39 | */ |
40 | 40 | public function __invoke(Request $request, Response $response, callable $next = null) |
41 | 41 | { |
42 | - return new HtmlResponse($this->template->render('admin::index', ['layout' => 'layout/admin'])); |
|
42 | + return new HtmlResponse($this->template->render('admin::index', [ 'layout' => 'layout/admin' ])); |
|
43 | 43 | } |
44 | 44 | } |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | $allUsers = array_column($articlePosts->getAdapter()->fetchAll('select admin_user_uuid from admin_users'), 'admin_user_uuid'); |
19 | 19 | $allCategory = array_column($articlePosts->getAdapter()->fetchAll('select category_uuid from category'), 'category_uuid'); |
20 | 20 | |
21 | - for($i = 0; $i < $count; $i++) { |
|
21 | + for ($i = 0; $i < $count; $i++) { |
|
22 | 22 | // Insert Article |
23 | 23 | $id = $faker->uuid; |
24 | 24 | $mysqlUuid = (new MysqlUuid\Uuid($id))->toFormat(new MysqlUuid\Formats\Binary()); |
25 | 25 | $title = $faker->sentence(); |
26 | - $userUuid = $allUsers[rand(0, (count($allUsers) - 1))]; |
|
27 | - $categoryUuid = $allCategory[rand(0, (count($allCategory) - 1))]; |
|
26 | + $userUuid = $allUsers[ rand(0, (count($allUsers) - 1)) ]; |
|
27 | + $categoryUuid = $allCategory[ rand(0, (count($allCategory) - 1)) ]; |
|
28 | 28 | $data = [ |
29 | 29 | 'article_uuid' => $mysqlUuid, |
30 | 30 | 'article_id' => $id, |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | 'title' => $title, |
47 | 47 | 'body' => $faker->paragraph(15), |
48 | 48 | 'lead' => $faker->paragraph(5), |
49 | - 'featured_img' => $featuredImages[rand(0, (count($featuredImages) - 1))], |
|
50 | - 'main_img' => $mainImages[rand(0, (count($mainImages) - 1))], |
|
49 | + 'featured_img' => $featuredImages[ rand(0, (count($featuredImages) - 1)) ], |
|
50 | + 'main_img' => $mainImages[ rand(0, (count($mainImages) - 1)) ], |
|
51 | 51 | 'has_layout' => true, |
52 | 52 | ]; |
53 | 53 |