@@ -7,7 +7,7 @@ |
||
7 | 7 | public function testSessionFactoryShouldCreateInstanceOfSessionManager() |
8 | 8 | { |
9 | 9 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
10 | - ->setMethods(['get']) |
|
10 | + ->setMethods([ 'get' ]) |
|
11 | 11 | ->getMockForAbstractClass(); |
12 | 12 | $sessionFactory = new \Admin\Factory\SessionFactory(); |
13 | 13 | static::assertInstanceOf(\Zend\Session\SessionManager::class, $sessionFactory($container)); |
@@ -11,11 +11,11 @@ |
||
11 | 11 | ->disableOriginalConstructor() |
12 | 12 | ->getMock(); |
13 | 13 | $container = $this->getMockBuilder('Interop\Container\ContainerInterface') |
14 | - ->setMethods(['get']) |
|
14 | + ->setMethods([ 'get' ]) |
|
15 | 15 | ->getMockForAbstractClass(); |
16 | 16 | $container->expects(static::at(0)) |
17 | 17 | ->method('get') |
18 | - ->will(static::returnValue(['upload' => ['public_path' => 'test', 'non_public_path' => 'test']])); |
|
18 | + ->will(static::returnValue([ 'upload' => [ 'public_path' => 'test', 'non_public_path' => 'test' ] ])); |
|
19 | 19 | $container->expects(static::at(1)) |
20 | 20 | ->method('get') |
21 | 21 | ->will(static::returnValue(new \Admin\Mapper\AdminUsersMapper())); |
@@ -10,7 +10,7 @@ |
||
10 | 10 | ->getMockForAbstractClass(); |
11 | 11 | $session = new \Zend\Session\SessionManager(); |
12 | 12 | $container = $this->getMockBuilder('Interop\Container\ContainerInterface') |
13 | - ->setMethods(['get']) |
|
13 | + ->setMethods([ 'get' ]) |
|
14 | 14 | ->getMockForAbstractClass(); |
15 | 15 | $container->expects(static::at(0)) |
16 | 16 | ->method('get') |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Page\View\Helper; |
4 | 4 | |
5 | 5 | use Page\Service\PageService; |
@@ -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 |