@@ -33,16 +33,16 @@ |
||
33 | 33 | */ |
34 | 34 | public function __invoke($menuItem) |
35 | 35 | { |
36 | - if($menuItem['href']) { |
|
37 | - return strpos($menuItem['href'], 'http') === 0 ? $menuItem['href'] : '/' . $menuItem['href']; |
|
36 | + if ($menuItem[ 'href' ]) { |
|
37 | + return strpos($menuItem[ 'href' ], 'http') === 0 ? $menuItem[ 'href' ] : '/' . $menuItem[ 'href' ]; |
|
38 | 38 | } |
39 | - elseif($menuItem['article_slug']) { |
|
40 | - $params = ['segment_1' => $menuItem['category_slug'], 'segment_2' => $menuItem['article_slug']]; |
|
39 | + elseif ($menuItem[ 'article_slug' ]) { |
|
40 | + $params = [ 'segment_1' => $menuItem[ 'category_slug' ], 'segment_2' => $menuItem[ 'article_slug' ] ]; |
|
41 | 41 | |
42 | 42 | return $this->url->__invoke('post', $params); |
43 | 43 | } |
44 | - elseif($menuItem['category_slug']) { |
|
45 | - return $this->url->__invoke('category', ['category' => $menuItem['category_slug']]); |
|
44 | + elseif ($menuItem[ 'category_slug' ]) { |
|
45 | + return $this->url->__invoke('category', [ 'category' => $menuItem[ 'category_slug' ] ]); |
|
46 | 46 | } |
47 | 47 | else { |
48 | 48 | return '#'; |
@@ -35,16 +35,13 @@ |
||
35 | 35 | { |
36 | 36 | if($menuItem['href']) { |
37 | 37 | return strpos($menuItem['href'], 'http') === 0 ? $menuItem['href'] : '/' . $menuItem['href']; |
38 | - } |
|
39 | - elseif($menuItem['article_slug']) { |
|
38 | + } elseif($menuItem['article_slug']) { |
|
40 | 39 | $params = ['segment_1' => $menuItem['category_slug'], 'segment_2' => $menuItem['article_slug']]; |
41 | 40 | |
42 | 41 | return $this->url->__invoke('post', $params); |
43 | - } |
|
44 | - elseif($menuItem['category_slug']) { |
|
42 | + } elseif($menuItem['category_slug']) { |
|
45 | 43 | return $this->url->__invoke('category', ['category' => $menuItem['category_slug']]); |
46 | - } |
|
47 | - else { |
|
44 | + } else { |
|
48 | 45 | return '#'; |
49 | 46 | } |
50 | 47 | } |
@@ -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' => 'Svi članci', |
62 | 62 | 'slug' => 'all' |
63 | 63 | ]; |