@@ -18,7 +18,7 @@ |
||
18 | 18 | ->getMockForAbstractClass(); |
19 | 19 | $session = new \Zend\Session\SessionManager(); |
20 | 20 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
21 | - ->setMethods(['get']) |
|
21 | + ->setMethods([ 'get' ]) |
|
22 | 22 | ->getMockForAbstractClass(); |
23 | 23 | $container->expects(static::at(0)) |
24 | 24 | ->method('get') |
@@ -20,11 +20,11 @@ |
||
20 | 20 | ->getMockForAbstractClass(); |
21 | 21 | |
22 | 22 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
23 | - ->setMethods(['get']) |
|
23 | + ->setMethods([ 'get' ]) |
|
24 | 24 | ->getMockForAbstractClass(); |
25 | 25 | $container->expects(static::at(0)) |
26 | 26 | ->method('get') |
27 | - ->will(static::returnValue(['upload' => ['public_path' => 'test', 'non_public_path' => 'test']])); |
|
27 | + ->will(static::returnValue([ 'upload' => [ 'public_path' => 'test', 'non_public_path' => 'test' ] ])); |
|
28 | 28 | $container->expects(static::at(1)) |
29 | 29 | ->method('get') |
30 | 30 | ->will(static::returnValue($articleMapper)); |
@@ -20,11 +20,11 @@ |
||
20 | 20 | ->getMockForAbstractClass(); |
21 | 21 | |
22 | 22 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
23 | - ->setMethods(['get']) |
|
23 | + ->setMethods([ 'get' ]) |
|
24 | 24 | ->getMockForAbstractClass(); |
25 | 25 | $container->expects(static::at(0)) |
26 | 26 | ->method('get') |
27 | - ->will(static::returnValue(['upload' => ['public_path' => 'test', 'non_public_path' => 'test']])); |
|
27 | + ->will(static::returnValue([ 'upload' => [ 'public_path' => 'test', 'non_public_path' => 'test' ] ])); |
|
28 | 28 | $container->expects(static::at(1)) |
29 | 29 | ->method('get') |
30 | 30 | ->will(static::returnValue($articleMapper)); |
@@ -10,7 +10,7 @@ |
||
10 | 10 | ->disableOriginalConstructor() |
11 | 11 | ->getMockForAbstractClass(); |
12 | 12 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
13 | - ->setMethods(['get']) |
|
13 | + ->setMethods([ 'get' ]) |
|
14 | 14 | ->getMockForAbstractClass(); |
15 | 15 | $container->expects(static::at(0)) |
16 | 16 | ->method('get') |
@@ -9,16 +9,16 @@ |
||
9 | 9 | |
10 | 10 | public function up() |
11 | 11 | { |
12 | - $this->table('category', ['id' => false, 'primary_key' => 'category_uuid']) |
|
13 | - ->addColumn('category_uuid', 'binary', ['limit' => 16]) |
|
12 | + $this->table('category', [ 'id' => false, 'primary_key' => 'category_uuid' ]) |
|
13 | + ->addColumn('category_uuid', 'binary', [ 'limit' => 16 ]) |
|
14 | 14 | ->addColumn('category_id', 'text') |
15 | 15 | ->addColumn('name', 'text') |
16 | 16 | ->addColumn('slug', 'text') |
17 | - ->addColumn('title', 'text', ['null' => true]) |
|
18 | - ->addColumn('description', 'text', ['null' => true]) |
|
19 | - ->addColumn('main_img', 'text', ['null' => true]) |
|
20 | - ->addColumn('is_in_homepage', 'boolean', ['default' => false]) |
|
21 | - ->addColumn('is_in_category_list', 'boolean', ['default' => true]) |
|
17 | + ->addColumn('title', 'text', [ 'null' => true ]) |
|
18 | + ->addColumn('description', 'text', [ 'null' => true ]) |
|
19 | + ->addColumn('main_img', 'text', [ 'null' => true ]) |
|
20 | + ->addColumn('is_in_homepage', 'boolean', [ 'default' => false ]) |
|
21 | + ->addColumn('is_in_category_list', 'boolean', [ 'default' => true ]) |
|
22 | 22 | ->create(); |
23 | 23 | } |
24 | 24 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Category\Factory\Service; |
5 | 5 | |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function __invoke(ContainerInterface $container): CategoryService |
22 | 22 | { |
23 | - $config = $container->get('config')['upload']; |
|
24 | - $upload = new Upload($config['public_path'], $config['non_public_path']); |
|
23 | + $config = $container->get('config')[ 'upload' ]; |
|
24 | + $upload = new Upload($config[ 'public_path' ], $config[ 'non_public_path' ]); |
|
25 | 25 | |
26 | 26 | return new CategoryService( |
27 | 27 | $container->get(CategoryMapper::class), |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | /** |
165 | 165 | * Return categories with posts/articles |
166 | 166 | * |
167 | - * @param null $inHomepage |
|
167 | + * @param boolean $inHomepage |
|
168 | 168 | * @param null $inCategoryList |
169 | 169 | * @return mixed |
170 | 170 | */ |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | /** |
185 | 185 | * Return categories posts/articles |
186 | 186 | * |
187 | - * @param null $inCategoryList |
|
187 | + * @param boolean $inCategoryList |
|
188 | 188 | * @return null|\Zend\Db\ResultSet\ResultSetInterface |
189 | 189 | */ |
190 | 190 | 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 | /** |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | $categories = $this->categoryMapper->getWeb(7, null, $inHomepage, $inCategoryList)->toArray(); |
172 | 172 | |
173 | 173 | foreach ($categories as $ctn => $category) { |
174 | - $select = $this->categoryMapper->getCategoryPostsSelect($category['category_id'], 4); |
|
174 | + $select = $this->categoryMapper->getCategoryPostsSelect($category[ 'category_id' ], 4); |
|
175 | 175 | $posts = $this->categoryMapper->selectWith($select)->toArray(); |
176 | - $categories[$ctn]['posts'] = $posts; |
|
176 | + $categories[ $ctn ][ 'posts' ] = $posts; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | return $categories; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function getCategories($inCategoryList = null) |
189 | 189 | { |
190 | - return $this->categoryMapper->getWeb(null, ['name' => 'asc'], null, $inCategoryList); |
|
190 | + return $this->categoryMapper->getWeb(null, [ 'name' => 'asc' ], null, $inCategoryList); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -29,16 +29,16 @@ |
||
29 | 29 | |
30 | 30 | public function getHeaderMenu() |
31 | 31 | { |
32 | - return $this->menuService->getNestedAll(true, ['is_in_header' => true]); |
|
32 | + return $this->menuService->getNestedAll(true, [ 'is_in_header' => true ]); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function getFooterMenu() |
36 | 36 | { |
37 | - return $this->menuService->getNestedAll(true, ['is_in_footer' => true]); |
|
37 | + return $this->menuService->getNestedAll(true, [ 'is_in_footer' => true ]); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function getSideMenu() |
41 | 41 | { |
42 | - return $this->menuService->getNestedAll(true, ['is_in_side' => true]); |
|
42 | + return $this->menuService->getNestedAll(true, [ 'is_in_side' => true ]); |
|
43 | 43 | } |
44 | 44 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | /** |
150 | 150 | * |
151 | 151 | * |
152 | - * @var \Zend\Diactoros\Response $returnedResponse |
|
152 | + * @var \Zend\Diactoros\Response $returnedResponse |
|
153 | 153 | */ |
154 | 154 | $returnedResponse = $eventController($request, $response); |
155 | 155 | static::assertSame(302, $returnedResponse->getStatusCode()); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | /** |
195 | 195 | * |
196 | 196 | * |
197 | - * @var \Zend\Diactoros\Response $returnedResponse |
|
197 | + * @var \Zend\Diactoros\Response $returnedResponse |
|
198 | 198 | */ |
199 | 199 | $returnedResponse = $eventController($request, $response); |
200 | 200 | static::assertSame(302, $returnedResponse->getStatusCode()); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | /** |
243 | 243 | * |
244 | 244 | * |
245 | - * @var \Zend\Diactoros\Response $returnedResponse |
|
245 | + * @var \Zend\Diactoros\Response $returnedResponse |
|
246 | 246 | */ |
247 | 247 | $returnedResponse = $eventController($request, $response); |
248 | 248 | static::assertSame(200, $returnedResponse->getStatusCode()); |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | /** |
331 | 331 | * |
332 | 332 | * |
333 | - * @var \Zend\Diactoros\Response $returnedResponse |
|
333 | + * @var \Zend\Diactoros\Response $returnedResponse |
|
334 | 334 | */ |
335 | 335 | $returnedResponse = $eventController($request, $response); |
336 | 336 | static::assertSame(302, $returnedResponse->getStatusCode()); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | public function testIndexMethodShouldReturnHtmlResponse() |
8 | 8 | { |
9 | 9 | $template = $this->getMockBuilder(\Zend\Expressive\Template\TemplateRendererInterface::class) |
10 | - ->setMethods(['render']) |
|
10 | + ->setMethods([ 'render' ]) |
|
11 | 11 | ->getMockForAbstractClass(); |
12 | 12 | $template->expects(static::once()) |
13 | 13 | ->method('render') |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $sessionStorage = new \Zend\Session\Storage\ArrayStorage(); |
44 | 44 | $sessionStorage->user = $user; |
45 | 45 | $template = $this->getMockBuilder(\Zend\Expressive\Template\TemplateRendererInterface::class) |
46 | - ->setMethods(['render']) |
|
46 | + ->setMethods([ 'render' ]) |
|
47 | 47 | ->getMockForAbstractClass(); |
48 | 48 | $template->expects(static::once()) |
49 | 49 | ->method('render') |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $sessionStorage = new \Zend\Session\Storage\ArrayStorage(); |
81 | 81 | $sessionStorage->user = $user; |
82 | 82 | $template = $this->getMockBuilder(\Zend\Expressive\Template\TemplateRendererInterface::class) |
83 | - ->setMethods(['render']) |
|
83 | + ->setMethods([ 'render' ]) |
|
84 | 84 | ->getMockForAbstractClass(); |
85 | 85 | $template->expects(static::once()) |
86 | 86 | ->method('render') |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $request = new \Zend\Diactoros\ServerRequest(); |
100 | 100 | $request = $request->withAttribute('action', 'edit'); |
101 | 101 | $request = $request->withAttribute('id', 1); |
102 | - $request = $request->withParsedBody(['event' => 'test']); |
|
102 | + $request = $request->withParsedBody([ 'event' => 'test' ]); |
|
103 | 103 | $response = new \Zend\Diactoros\Response(); |
104 | 104 | $eventController = new \Article\Controller\EventController( |
105 | 105 | $template, |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | ->will(static::returnValue('http://unfinished.dev/admin')); |
138 | 138 | $request = new \Zend\Diactoros\ServerRequest(); |
139 | 139 | $request = $request->withAttribute('action', 'save'); |
140 | - $request = $request->withParsedBody(['event' => 'test']); |
|
140 | + $request = $request->withParsedBody([ 'event' => 'test' ]); |
|
141 | 141 | $response = new \Zend\Diactoros\Response(); |
142 | 142 | $eventController = new \Article\Controller\EventController( |
143 | 143 | $template, |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $request = new \Zend\Diactoros\ServerRequest(); |
183 | 183 | $request = $request->withAttribute('action', 'save'); |
184 | 184 | $request = $request->withAttribute('id', 2); |
185 | - $request = $request->withParsedBody(['event' => 'test']); |
|
185 | + $request = $request->withParsedBody([ 'event' => 'test' ]); |
|
186 | 186 | $response = new \Zend\Diactoros\Response(); |
187 | 187 | $eventController = new \Article\Controller\EventController( |
188 | 188 | $template, |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | ->getMock(); |
222 | 222 | $eventService->expects(static::once()) |
223 | 223 | ->method('updateArticle') |
224 | - ->willThrowException(new \Std\FilterException(['test error'])); |
|
224 | + ->willThrowException(new \Std\FilterException([ 'test error' ])); |
|
225 | 225 | $categoryService = $this->getMockBuilder(\Category\Service\CategoryService::class) |
226 | 226 | ->disableOriginalConstructor() |
227 | 227 | ->getMock(); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $request = new \Zend\Diactoros\ServerRequest(); |
231 | 231 | $request = $request->withAttribute('action', 'save'); |
232 | 232 | $request = $request->withAttribute('id', 2); |
233 | - $request = $request->withParsedBody(['event' => 'test']); |
|
233 | + $request = $request->withParsedBody([ 'event' => 'test' ]); |
|
234 | 234 | $response = new \Zend\Diactoros\Response(); |
235 | 235 | $eventController = new \Article\Controller\EventController( |
236 | 236 | $template, |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $request = new \Zend\Diactoros\ServerRequest(); |
281 | 281 | $request = $request->withAttribute('action', 'save'); |
282 | 282 | $request = $request->withAttribute('id', 2); |
283 | - $request = $request->withParsedBody(['event' => 'test']); |
|
283 | + $request = $request->withParsedBody([ 'event' => 'test' ]); |
|
284 | 284 | $response = new \Zend\Diactoros\Response(); |
285 | 285 | $eventController = new \Article\Controller\EventController( |
286 | 286 | $template, |