@@ -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,17 +51,17 @@ 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 | - if($urlSlug !== 'all') { |
|
59 | + if (!$category) { |
|
60 | + if ($urlSlug !== 'all') { |
|
61 | 61 | return $next($request, $response); |
62 | 62 | } |
63 | 63 | |
64 | - $category = (object)[ |
|
64 | + $category = (object) [ |
|
65 | 65 | 'name' => 'Svi članci', |
66 | 66 | 'slug' => 'all' |
67 | 67 | ]; |
@@ -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 | } else { |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | |
59 | 59 | $post = $this->postService->fetchSingleArticleBySlug($postSlug); |
60 | 60 | |
61 | - if(!$post) { |
|
61 | + if (!$post) { |
|
62 | 62 | return $next($request, $response); |
63 | 63 | } |
64 | 64 | |
65 | 65 | list($previousPost, $nextPost) = $this->postService->fetchNearestArticle($post->published_at); |
66 | 66 | |
67 | - if(!$post) { |
|
67 | + if (!$post) { |
|
68 | 68 | $response = $response->withStatus(404); |
69 | 69 | |
70 | 70 | return $next($request, $response, new \Exception("Post by URL does not exist!", 404)); |