@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Core\Factory\Service; |
5 | 5 | |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | */ |
17 | 17 | public function __invoke(ContainerInterface $container): MeetupApiService |
18 | 18 | { |
19 | - $config = $container->get('config')['meetupApi']; |
|
19 | + $config = $container->get('config')[ 'meetupApi' ]; |
|
20 | 20 | |
21 | - return new MeetupApiService($config['key']); |
|
21 | + return new MeetupApiService($config[ 'key' ]); |
|
22 | 22 | } |
23 | 23 | } |
@@ -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 | ]; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Article\Mapper; |
5 | 5 | |
@@ -34,22 +34,22 @@ discard block |
||
34 | 34 | public function getPaginationSelect() |
35 | 35 | { |
36 | 36 | return $this->getSql()->select() |
37 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'is_homepage']) |
|
37 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'is_homepage' ]) |
|
38 | 38 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
39 | - ->join('category', 'articles.category_uuid = category.category_uuid', ['category_name' => 'name'], 'left') |
|
40 | - ->where(['articles.type' => ArticleType::POST]) |
|
41 | - ->order(['created_at' => 'desc']); |
|
39 | + ->join('category', 'articles.category_uuid = category.category_uuid', [ 'category_name' => 'name' ], 'left') |
|
40 | + ->where([ 'articles.type' => ArticleType::POST ]) |
|
41 | + ->order([ 'created_at' => 'desc' ]); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public function get($id) |
45 | 45 | { |
46 | 46 | $select = $this->getSql()->select() |
47 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout', 'is_homepage']) |
|
47 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout', 'is_homepage' ]) |
|
48 | 48 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
49 | 49 | ->join('category', 'category.category_uuid = articles.category_uuid', |
50 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left') |
|
51 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
52 | - ->where(['articles.article_id' => $id]); |
|
50 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left') |
|
51 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
52 | + ->where([ 'articles.article_id' => $id ]); |
|
53 | 53 | |
54 | 54 | return $this->selectWith($select)->current(); |
55 | 55 | } |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | { |
59 | 59 | $select = $this->getSql()->select() |
60 | 60 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
61 | - ->join('category', 'category.category_uuid = articles.category_uuid', ['category_slug' => 'slug']) |
|
61 | + ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_slug' => 'slug' ]) |
|
62 | 62 | ->limit(1); |
63 | 63 | |
64 | - if($direction > 0) { |
|
64 | + if ($direction > 0) { |
|
65 | 65 | $select->where->greaterThan('published_at', $publishedAt); |
66 | - $select->order(['published_at' => 'asc']); |
|
67 | - } elseif($direction < 0) { |
|
66 | + $select->order([ 'published_at' => 'asc' ]); |
|
67 | + } elseif ($direction < 0) { |
|
68 | 68 | $select->where->lessThan('published_at', $publishedAt); |
69 | - $select->order(['published_at' => 'desc']); |
|
69 | + $select->order([ 'published_at' => 'desc' ]); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | return $this->selectWith($select)->current(); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $select = $this->getSql()->select() |
78 | 78 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
79 | - ->where(['article_posts.is_homepage' => true, 'articles.status' => 1]); |
|
79 | + ->where([ 'article_posts.is_homepage' => true, 'articles.status' => 1 ]); |
|
80 | 80 | |
81 | 81 | return $this->selectWith($select)->current(); |
82 | 82 | } |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | public function getBySlug($slug) |
85 | 85 | { |
86 | 86 | $select = $this->getSql()->select() |
87 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img']) |
|
87 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img' ]) |
|
88 | 88 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
89 | - ->join('category', 'category.category_uuid = articles.category_uuid', ['category_name' => 'name', 'category_slug' => 'slug']) |
|
90 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name']) |
|
91 | - ->where(['articles.slug' => $slug, 'articles.status' => 1]); |
|
89 | + ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_name' => 'name', 'category_slug' => 'slug' ]) |
|
90 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ]) |
|
91 | + ->where([ 'articles.slug' => $slug, 'articles.status' => 1 ]); |
|
92 | 92 | |
93 | 93 | return $this->selectWith($select)->current(); |
94 | 94 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function getAll() |
97 | 97 | { |
98 | 98 | $select = $this->getSql()->select() |
99 | - ->join('articles', 'article_posts.article_uuid = articles.article_uuid', ['article_id', 'slug']); |
|
99 | + ->join('articles', 'article_posts.article_uuid = articles.article_uuid', [ 'article_id', 'slug' ]); |
|
100 | 100 | |
101 | 101 | return $this->selectWith($select); |
102 | 102 | } |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | { |
106 | 106 | $select = $this->getSql()->select() |
107 | 107 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
108 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name']) |
|
108 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ]) |
|
109 | 109 | ->join('category', 'category.category_uuid = articles.category_uuid', |
110 | - ['category_name' => 'name', 'category_id', 'category_slug' => 'slug']) |
|
111 | - ->where(['articles.status' => 1]) |
|
112 | - ->order(['articles.published_at' => 'desc']) |
|
110 | + [ 'category_name' => 'name', 'category_id', 'category_slug' => 'slug' ]) |
|
111 | + ->where([ 'articles.status' => 1 ]) |
|
112 | + ->order([ 'articles.published_at' => 'desc' ]) |
|
113 | 113 | ->limit($limit); |
114 | 114 | |
115 | 115 | return $this->selectWith($select); |
@@ -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 Article\Mapper; |
6 | 6 | |
@@ -21,21 +21,21 @@ discard block |
||
21 | 21 | public function getPaginationSelect() |
22 | 22 | { |
23 | 23 | return $this->getSql()->select() |
24 | - ->columns(['title', 'body']) |
|
24 | + ->columns([ 'title', 'body' ]) |
|
25 | 25 | ->join('articles', 'article_discussions.article_uuid = articles.article_uuid') |
26 | - ->where(['articles.type' => ArticleType::DISCUSSION]) |
|
27 | - ->order(['created_at' => 'desc']); |
|
26 | + ->where([ 'articles.type' => ArticleType::DISCUSSION ]) |
|
27 | + ->order([ 'created_at' => 'desc' ]); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function get($id) |
31 | 31 | { |
32 | 32 | $select = $this->getSql()->select() |
33 | - ->columns(['title', 'body']) |
|
33 | + ->columns([ 'title', 'body' ]) |
|
34 | 34 | ->join('articles', 'article_discussions.article_uuid = articles.article_uuid') |
35 | 35 | ->join('category', 'category.category_uuid = articles.category_uuid', |
36 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left') |
|
37 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
38 | - ->where(['articles.article_id' => $id]); |
|
36 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left') |
|
37 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
38 | + ->where([ 'articles.article_id' => $id ]); |
|
39 | 39 | |
40 | 40 | return $this->selectWith($select)->current(); |
41 | 41 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $articleFilter = $this->articleFilter->getInputFilter()->setData($data); |
54 | 54 | $discussionFilter = $this->discussionFilter->getInputFilter()->setData($data); |
55 | 55 | |
56 | - if(!$articleFilter->isValid() || !$discussionFilter->isValid()) { |
|
56 | + if (!$articleFilter->isValid() || !$discussionFilter->isValid()) { |
|
57 | 57 | throw new FilterException($articleFilter->getMessages() + $discussionFilter->getMessages()); |
58 | 58 | } |
59 | 59 | |
@@ -62,16 +62,16 @@ discard block |
||
62 | 62 | |
63 | 63 | $article = $articleFilter->getValues(); |
64 | 64 | $article += [ |
65 | - 'admin_user_uuid' => $this->adminUsersMapper->getUuid($article['admin_user_id']), |
|
65 | + 'admin_user_uuid' => $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]), |
|
66 | 66 | 'type' => ArticleType::DISCUSSION, |
67 | 67 | 'article_id' => $id, |
68 | 68 | 'article_uuid' => $uuId |
69 | 69 | ]; |
70 | 70 | |
71 | - $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid; |
|
72 | - unset($article['category_id'], $article['admin_user_id']); |
|
71 | + $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid; |
|
72 | + unset($article[ 'category_id' ], $article[ 'admin_user_id' ]); |
|
73 | 73 | |
74 | - $discussion = $discussionFilter->getValues() + ['article_uuid' => $uuId]; |
|
74 | + $discussion = $discussionFilter->getValues() + [ 'article_uuid' => $uuId ]; |
|
75 | 75 | |
76 | 76 | $this->articleMapper->insert($article); |
77 | 77 | $this->articleDiscussionsMapper->insert($discussion); |
@@ -83,30 +83,30 @@ discard block |
||
83 | 83 | $articleFilter = $this->articleFilter->getInputFilter()->setData($data); |
84 | 84 | $discussionFilter = $this->discussionFilter->getInputFilter()->setData($data); |
85 | 85 | |
86 | - if(!$articleFilter->isValid() || !$discussionFilter->isValid()) { |
|
86 | + if (!$articleFilter->isValid() || !$discussionFilter->isValid()) { |
|
87 | 87 | throw new FilterException($articleFilter->getMessages() + $discussionFilter->getMessages()); |
88 | 88 | } |
89 | 89 | |
90 | - $article = $articleFilter->getValues() + ['article_uuid' => $article->article_uuid]; |
|
90 | + $article = $articleFilter->getValues() + [ 'article_uuid' => $article->article_uuid ]; |
|
91 | 91 | $discussion = $discussionFilter->getValues(); |
92 | 92 | |
93 | - $article['admin_user_uuid'] = $this->adminUsersMapper->getUuid($article['admin_user_id']); |
|
94 | - $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid; |
|
95 | - unset($article['category_id'], $article['admin_user_id']); |
|
93 | + $article[ 'admin_user_uuid' ] = $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]); |
|
94 | + $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid; |
|
95 | + unset($article[ 'category_id' ], $article[ 'admin_user_id' ]); |
|
96 | 96 | |
97 | - $this->articleMapper->update($article, ['article_uuid' => $article['article_uuid']]); |
|
98 | - $this->articleDiscussionsMapper->update($discussion, ['article_uuid' => $article['article_uuid']]); |
|
97 | + $this->articleMapper->update($article, [ 'article_uuid' => $article[ 'article_uuid' ] ]); |
|
98 | + $this->articleDiscussionsMapper->update($discussion, [ 'article_uuid' => $article[ 'article_uuid' ] ]); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | public function deleteArticle($id) |
102 | 102 | { |
103 | 103 | $discussion = $this->articleDiscussionsMapper->get($id); |
104 | 104 | |
105 | - if(!$discussion) { |
|
105 | + if (!$discussion) { |
|
106 | 106 | throw new \Exception('Article not found!'); |
107 | 107 | } |
108 | 108 | |
109 | - $this->articleDiscussionsMapper->delete(['article_uuid' => $discussion->article_uuid]); |
|
109 | + $this->articleDiscussionsMapper->delete([ 'article_uuid' => $discussion->article_uuid ]); |
|
110 | 110 | $this->delete($discussion->article_uuid); |
111 | 111 | } |
112 | 112 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Newsletter\Mapper; |
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 Newsletter\Web\Action; |
6 | 6 |
@@ -20,14 +20,14 @@ |
||
20 | 20 | { |
21 | 21 | try { |
22 | 22 | $data = $request->getParsedBody(); |
23 | - $email = isset($data['email']) ? $data['email'] : null; |
|
23 | + $email = isset($data[ 'email' ]) ? $data[ 'email' ] : null; |
|
24 | 24 | |
25 | 25 | $this->newsletterService->registerNew($email); |
26 | 26 | |
27 | - return new JsonResponse(['message' => 'Uspešno ste se prijavili.']); |
|
27 | + return new JsonResponse([ 'message' => 'Uspešno ste se prijavili.' ]); |
|
28 | 28 | } |
29 | - catch(\Exception $e) { |
|
30 | - return new JsonResponse(['message' => $e->getMessage()], $e->getCode()); |
|
29 | + catch (\Exception $e) { |
|
30 | + return new JsonResponse([ 'message' => $e->getMessage() ], $e->getCode()); |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | } |
@@ -25,8 +25,7 @@ |
||
25 | 25 | $this->newsletterService->registerNew($email); |
26 | 26 | |
27 | 27 | return new JsonResponse(['message' => 'Uspešno ste se prijavili.']); |
28 | - } |
|
29 | - catch(\Exception $e) { |
|
28 | + } catch(\Exception $e) { |
|
30 | 29 | return new JsonResponse(['message' => $e->getMessage()], $e->getCode()); |
31 | 30 | } |
32 | 31 | } |