@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Web\Action; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Web\Action; |
6 | 6 |
@@ -13,8 +13,8 @@ |
||
13 | 13 | 'article/pagination' => 'templates/partial/pagination.phtml', |
14 | 14 | ], |
15 | 15 | 'paths' => [ |
16 | - 'templates' => ['templates'], |
|
17 | - 'web' => ['templates/web'], |
|
16 | + 'templates' => [ 'templates' ], |
|
17 | + 'web' => [ 'templates/web' ], |
|
18 | 18 | ], |
19 | 19 | ], |
20 | 20 |
@@ -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 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | public function __invoke(Request $request, Response $response, callable $next = null): HtmlResponse |
47 | 47 | { |
48 | 48 | // Set custom html from view file |
49 | - return new HtmlResponse($this->template->render('web::home', ['layout' => 'layout/web'])); |
|
49 | + return new HtmlResponse($this->template->render('web::home', [ 'layout' => 'layout/web' ])); |
|
50 | 50 | |
51 | 51 | //$article = $this->postService->getHomepage(); |
52 | 52 | // |
@@ -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 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $urlSlug1 = $request->getAttribute('segment_1'); |
49 | 49 | $urlSlug2 = $request->getAttribute('segment_2'); |
50 | 50 | |
51 | - if($urlSlug2) { |
|
51 | + if ($urlSlug2) { |
|
52 | 52 | $categorySlug = $urlSlug1; |
53 | 53 | $postSlug = $urlSlug2; |
54 | 54 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | list($previousPost, $nextPost) = $this->postService->fetchNearestArticle($post->published_at); |
63 | 63 | |
64 | - if(!$post) { |
|
64 | + if (!$post) { |
|
65 | 65 | $response = $response->withStatus(404); |
66 | 66 | |
67 | 67 | return $next($request, $response, new \Exception("Post by URL does not exist!", 404)); |
@@ -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 | |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | public function __invoke(Request $request, Response $response, callable $next = null) |
52 | 52 | { |
53 | 53 | $params = $request->getQueryParams(); |
54 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
54 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
55 | 55 | $urlSlug = $request->getAttribute('category'); |
56 | 56 | $categories = $this->categoryService->allWeb(); |
57 | 57 | $category = $this->categoryService->getCategoryBySlug($urlSlug); |
58 | 58 | |
59 | - if(!$category) { |
|
60 | - $category = (object)[ |
|
59 | + if (!$category) { |
|
60 | + $category = (object) [ |
|
61 | 61 | 'name' => 'SveeEeEEeeEe', |
62 | 62 | 'slug' => 'all' |
63 | 63 | ]; |
@@ -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 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function __invoke(Request $request, Response $response, callable $next = null) |
52 | 52 | { |
53 | 53 | $params = $request->getQueryParams(); |
54 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
54 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
55 | 55 | $videos = $this->videoService->fetchWebArticles($page, 5); |
56 | 56 | |
57 | 57 | return new HtmlResponse($this->template->render('web::videos', [ |
@@ -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 |
@@ -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 | } |