@@ -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 @@ 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 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | callable $next = null |
61 | 61 | ) { |
62 | 62 | $params = $request->getQueryParams(); |
63 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
63 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
64 | 64 | $urlSlug = $request->getAttribute('category'); |
65 | 65 | $categories = $this->categoryService->getCategories(true); |
66 | 66 | $category = $this->categoryService->getCategoryBySlug($urlSlug); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | return $next($request, $response); |
71 | 71 | } |
72 | 72 | |
73 | - $category = (object)[ |
|
73 | + $category = (object) [ |
|
74 | 74 | 'name' => 'Svi članci', |
75 | 75 | 'slug' => 'all', |
76 | 76 | 'title' => 'Svi članci', |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | /** |
167 | 167 | * Return categories with posts(articles) |
168 | 168 | * |
169 | - * @param null $inHomepage |
|
169 | + * @param boolean $inHomepage |
|
170 | 170 | * @param null $inCategoryList |
171 | 171 | * @return mixed |
172 | 172 | */ |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | /** |
187 | 187 | * Return categories posts/articles |
188 | 188 | * |
189 | - * @param null $inCategoryList |
|
189 | + * @param boolean $inCategoryList |
|
190 | 190 | * @return null|\Zend\Db\ResultSet\ResultSetInterface |
191 | 191 | */ |
192 | 192 | public function getCategories($inCategoryList = null) |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function getCategoryBySlug($urlSlug) |
77 | 77 | { |
78 | - return $this->categoryMapper->select(['slug' => $urlSlug])->current(); |
|
78 | + return $this->categoryMapper->select([ 'slug' => $urlSlug ])->current(); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | $values = $filter->getValues(); |
96 | - $values['category_id'] = Uuid::uuid1()->toString(); |
|
97 | - $values['category_uuid'] = (new MysqlUuid($values['category_id']))->toFormat(new Binary); |
|
98 | - $values['main_img'] = $this->upload->uploadImage($data, 'main_img'); |
|
96 | + $values[ 'category_id' ] = Uuid::uuid1()->toString(); |
|
97 | + $values[ 'category_uuid' ] = (new MysqlUuid($values[ 'category_id' ]))->toFormat(new Binary); |
|
98 | + $values[ 'main_img' ] = $this->upload->uploadImage($data, 'main_img'); |
|
99 | 99 | |
100 | 100 | $this->categoryMapper->insert($values); |
101 | 101 | } |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | ]; |
126 | 126 | |
127 | 127 | // We don't want to force user to re-upload image on edit |
128 | - if (!$values['main_img']) { |
|
129 | - unset($values['main_img']); |
|
128 | + if (!$values[ 'main_img' ]) { |
|
129 | + unset($values[ 'main_img' ]); |
|
130 | 130 | } else { |
131 | 131 | $this->upload->deleteFile($oldCategory->main_img); |
132 | 132 | } |
133 | 133 | |
134 | - $this->categoryMapper->update($values, ['category_id' => $categoryId]); |
|
134 | + $this->categoryMapper->update($values, [ 'category_id' => $categoryId ]); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | $this->upload->deleteFile($category->main_img); |
148 | 148 | |
149 | - return (bool)$this->categoryMapper->delete(['category_id' => $categoryId]); |
|
149 | + return (bool) $this->categoryMapper->delete([ 'category_id' => $categoryId ]); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function getAll($type = null) |
158 | 158 | { |
159 | - if($type){ |
|
160 | - return $this->categoryMapper->select(['type' => $type]); |
|
159 | + if ($type) { |
|
160 | + return $this->categoryMapper->select([ 'type' => $type ]); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | return $this->categoryMapper->select(); |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | $categories = $this->categoryMapper->getWeb(7, null, $inHomepage, $inCategoryList)->toArray(); |
176 | 176 | |
177 | 177 | foreach ($categories as $ctn => $category) { |
178 | - $select = $this->categoryMapper->getCategoryPostsSelect($category['category_id'], 4); |
|
178 | + $select = $this->categoryMapper->getCategoryPostsSelect($category[ 'category_id' ], 4); |
|
179 | 179 | $posts = $this->categoryMapper->selectWith($select)->toArray(); |
180 | - $categories[$ctn]['posts'] = $posts; |
|
180 | + $categories[ $ctn ][ 'posts' ] = $posts; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | return $categories; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function getCategories($inCategoryList = null) |
193 | 193 | { |
194 | - return $this->categoryMapper->getWeb(null, ['name' => 'asc'], null, $inCategoryList); |
|
194 | + return $this->categoryMapper->getWeb(null, [ 'name' => 'asc' ], null, $inCategoryList); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | public function index(): HtmlResponse |
68 | 68 | { |
69 | 69 | $params = $this->request->getQueryParams(); |
70 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
71 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
70 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
71 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
72 | 72 | $posts = $this->postService->fetchAllArticles($page, $limit); |
73 | 73 | |
74 | 74 | return new HtmlResponse($this->template->render( |
75 | 75 | 'article::post/index', |
76 | - ['list' => $posts, 'layout' => 'layout/admin']) |
|
76 | + [ 'list' => $posts, 'layout' => 'layout/admin' ]) |
|
77 | 77 | ); |
78 | 78 | } |
79 | 79 | |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return \Psr\Http\Message\ResponseInterface |
84 | 84 | */ |
85 | - public function edit($errors = []): \Psr\Http\Message\ResponseInterface |
|
85 | + public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface |
|
86 | 86 | { |
87 | 87 | $id = $this->request->getAttribute('id'); |
88 | 88 | $post = $this->postService->fetchSingleArticle($id); |
89 | 89 | $categories = $this->categoryService->getAll(ArticleType::POST); |
90 | 90 | |
91 | 91 | if ($this->request->getParsedBody()) { |
92 | - $post = (object)($this->request->getParsedBody() + (array)$post); |
|
92 | + $post = (object) ($this->request->getParsedBody() + (array) $post); |
|
93 | 93 | $post->article_id = $id; |
94 | 94 | } |
95 | 95 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | return $this->response->withStatus(302)->withHeader( |
152 | - 'Location', $this->router->generateUri('admin.posts', ['action' => 'index']) |
|
152 | + 'Location', $this->router->generateUri('admin.posts', [ 'action' => 'index' ]) |
|
153 | 153 | ); |
154 | 154 | } |
155 | 155 | } |
@@ -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\Controller; |
5 | 5 | |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | public function index(): HtmlResponse |
60 | 60 | { |
61 | 61 | $params = $this->request->getQueryParams(); |
62 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
63 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
62 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
63 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
64 | 64 | $videos = $this->videoService->fetchAllArticles($page, $limit); |
65 | 65 | |
66 | 66 | return new HtmlResponse($this->template->render('article::video/index', |
67 | - ['list' => $videos, 'layout' => 'layout/admin']) |
|
67 | + [ 'list' => $videos, 'layout' => 'layout/admin' ]) |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return \Psr\Http\Message\ResponseInterface |
75 | 75 | */ |
76 | - public function edit($errors = []): \Psr\Http\Message\ResponseInterface |
|
76 | + public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface |
|
77 | 77 | { |
78 | 78 | $id = $this->request->getAttribute('id'); |
79 | 79 | $video = $this->videoService->fetchSingleArticle($id); |
80 | 80 | $categories = $this->categoryService->getAll(ArticleType::VIDEO); |
81 | 81 | |
82 | 82 | if ($this->request->getParsedBody()) { |
83 | - $video = (object)($this->request->getParsedBody() + (array)$video); |
|
83 | + $video = (object) ($this->request->getParsedBody() + (array) $video); |
|
84 | 84 | $video->article_id = $id; |
85 | 85 | } |
86 | 86 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | return $this->response->withStatus(302)->withHeader('Location', |
144 | - $this->router->generateUri('admin.videos', ['action' => 'index']) |
|
144 | + $this->router->generateUri('admin.videos', [ 'action' => 'index' ]) |
|
145 | 145 | ); |
146 | 146 | } |
147 | 147 | } |
@@ -46,24 +46,24 @@ |
||
46 | 46 | public function index(): \Psr\Http\Message\ResponseInterface |
47 | 47 | { |
48 | 48 | $params = $this->request->getQueryParams(); |
49 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
50 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
49 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
50 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
51 | 51 | $events = $this->eventService->fetchAllArticles($page, $limit); |
52 | 52 | |
53 | 53 | return new HtmlResponse($this->template->render( |
54 | 54 | 'article::event/index', |
55 | - ['list' => $events, 'layout' => 'layout/admin']) |
|
55 | + [ 'list' => $events, 'layout' => 'layout/admin' ]) |
|
56 | 56 | ); |
57 | 57 | } |
58 | 58 | |
59 | - public function edit($errors = []): \Psr\Http\Message\ResponseInterface |
|
59 | + public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface |
|
60 | 60 | { |
61 | 61 | $id = $this->request->getAttribute('id'); |
62 | 62 | $event = $this->eventService->fetchSingleArticle($id); |
63 | 63 | $categories = $this->categoryService->getAll(ArticleType::EVENT); |
64 | 64 | |
65 | 65 | if ($this->request->getParsedBody()) { |
66 | - $event = (object)($this->request->getParsedBody() + (array)$event); |
|
66 | + $event = (object) ($this->request->getParsedBody() + (array) $event); |
|
67 | 67 | $event->article_id = $id; |
68 | 68 | } |
69 | 69 |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | public function index(): \Psr\Http\Message\ResponseInterface |
71 | 71 | { |
72 | 72 | $params = $this->request->getQueryParams(); |
73 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
74 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
73 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
74 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
75 | 75 | |
76 | 76 | $discussions = $this->discussionService->fetchAllArticles($page, $limit); |
77 | 77 | |
78 | 78 | return new HtmlResponse($this->template->render( |
79 | 79 | 'article::discussion/index', |
80 | - ['list' => $discussions, 'layout' => 'layout/admin']) |
|
80 | + [ 'list' => $discussions, 'layout' => 'layout/admin' ]) |
|
81 | 81 | ); |
82 | 82 | } |
83 | 83 | |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return \Psr\Http\Message\ResponseInterface |
90 | 90 | */ |
91 | - public function edit($errors = []): \Psr\Http\Message\ResponseInterface |
|
91 | + public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface |
|
92 | 92 | { |
93 | 93 | $id = $this->request->getAttribute('id'); |
94 | 94 | $discussion = $this->discussionService->fetchSingleArticle($id); |
95 | 95 | $categories = $this->categoryService->getAll(ArticleType::DISCUSSION); |
96 | 96 | |
97 | 97 | if ($this->request->getParsedBody()) { |
98 | - $discussion = (object)($this->request->getParsedBody() + (array)$discussion); |
|
98 | + $discussion = (object) ($this->request->getParsedBody() + (array) $discussion); |
|
99 | 99 | $discussion->article_id = $id; |
100 | 100 | } |
101 | 101 |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | [ |
20 | 20 | 'name' => 'name', |
21 | 21 | 'required' => true, |
22 | - 'filters' => [['name' => 'StringTrim']], |
|
22 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
23 | 23 | 'validators' => [ |
24 | - ['name' => 'NotEmpty'], |
|
25 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 500]], |
|
24 | + [ 'name' => 'NotEmpty' ], |
|
25 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 500 ] ], |
|
26 | 26 | ], |
27 | 27 | ] |
28 | 28 | ); |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | [ |
32 | 32 | 'name' => 'slug', |
33 | 33 | 'required' => true, |
34 | - 'filters' => [['name' => 'StringTrim', 'options' => ['charlist' => '/']]], |
|
34 | + 'filters' => [ [ 'name' => 'StringTrim', 'options' => [ 'charlist' => '/' ] ] ], |
|
35 | 35 | 'validators' => [ |
36 | - ['name' => 'NotEmpty'], |
|
37 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
36 | + [ 'name' => 'NotEmpty' ], |
|
37 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
38 | 38 | ], |
39 | 39 | ] |
40 | 40 | ); |
@@ -43,24 +43,24 @@ discard block |
||
43 | 43 | [ |
44 | 44 | 'name' => 'title', |
45 | 45 | 'required' => false, |
46 | - 'filters' => [['name' => 'StringTrim']], |
|
46 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
47 | 47 | 'validators' => [ |
48 | - ['name' => 'NotEmpty'], |
|
49 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
48 | + [ 'name' => 'NotEmpty' ], |
|
49 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
50 | 50 | ], |
51 | 51 | ] |
52 | 52 | ); |
53 | 53 | |
54 | - $inputFilter->add(['name' => 'type', 'required' => true]); |
|
54 | + $inputFilter->add([ 'name' => 'type', 'required' => true ]); |
|
55 | 55 | |
56 | 56 | $inputFilter->add( |
57 | 57 | [ |
58 | 58 | 'name' => 'description', |
59 | 59 | 'required' => false, |
60 | - 'filters' => [['name' => 'StringTrim']], |
|
60 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
61 | 61 | 'validators' => [ |
62 | - ['name' => 'NotEmpty'], |
|
63 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 1000]], |
|
62 | + [ 'name' => 'NotEmpty' ], |
|
63 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 1000 ] ], |
|
64 | 64 | ], |
65 | 65 | ] |
66 | 66 | ); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | [ |
70 | 70 | 'name' => 'is_in_homepage', |
71 | 71 | 'required' => false, |
72 | - 'filters' => [['name' => 'Boolean']], |
|
72 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
73 | 73 | ] |
74 | 74 | ); |
75 | 75 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | [ |
78 | 78 | 'name' => 'is_in_category_list', |
79 | 79 | 'required' => false, |
80 | - 'filters' => [['name' => 'Boolean']], |
|
80 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
81 | 81 | ] |
82 | 82 | ); |
83 | 83 |
@@ -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 Category\Controller; |
6 | 6 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | public function index(): \Psr\Http\Message\ResponseInterface |
54 | 54 | { |
55 | 55 | $params = $this->request->getQueryParams(); |
56 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
57 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
56 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
57 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
58 | 58 | |
59 | 59 | $categories = $this->categoryService->getPagination($page, $limit); |
60 | 60 | |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return \Psr\Http\Message\ResponseInterface |
71 | 71 | */ |
72 | - public function edit($errors = []): \Psr\Http\Message\ResponseInterface |
|
72 | + public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface |
|
73 | 73 | { |
74 | 74 | $id = $this->request->getAttribute('id'); |
75 | 75 | $category = $this->categoryService->getCategory($id); |
76 | 76 | |
77 | 77 | if ($this->request->getParsedBody()) { |
78 | - $category = (object)($this->request->getParsedBody() + (array)$category); |
|
78 | + $category = (object) ($this->request->getParsedBody() + (array) $category); |
|
79 | 79 | $category->category_id = $id; |
80 | 80 | } |
81 | 81 |