@@ -33,6 +33,9 @@ |
||
33 | 33 | $this->adapter = $adapter; |
34 | 34 | } |
35 | 35 | |
36 | + /** |
|
37 | + * @param integer $status |
|
38 | + */ |
|
36 | 39 | public function getPaginationSelect($status = null) |
37 | 40 | { |
38 | 41 | $select = $this->getSql()->select() |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | public function getPaginationSelect($status = null) |
35 | 35 | { |
36 | 36 | $select = $this->getSql()->select() |
37 | - ->columns(['title', 'body', 'longitude', 'latitude']) |
|
37 | + ->columns([ 'title', 'body', 'longitude', 'latitude' ]) |
|
38 | 38 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
39 | 39 | ->join( |
40 | 40 | 'admin_users', |
41 | 41 | 'admin_users.admin_user_uuid = articles.admin_user_uuid', |
42 | - ['admin_user_id', 'first_name', 'last_name'] |
|
43 | - )->where(['articles.type' => ArticleType::EVENT]) |
|
44 | - ->order(['created_at' => 'desc']); |
|
42 | + [ 'admin_user_id', 'first_name', 'last_name' ] |
|
43 | + )->where([ 'articles.type' => ArticleType::EVENT ]) |
|
44 | + ->order([ 'created_at' => 'desc' ]); |
|
45 | 45 | |
46 | 46 | if ($status) { |
47 | - $select->where(['articles.status' => (int)$status]); |
|
47 | + $select->where([ 'articles.status' => (int) $status ]); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $select; |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
57 | 57 | ->join( |
58 | 58 | 'category', 'category.category_uuid = articles.category_uuid', |
59 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left' |
|
59 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left' |
|
60 | 60 | ) |
61 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
62 | - ->where(['articles.article_id' => $id]); |
|
61 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
62 | + ->where([ 'articles.article_id' => $id ]); |
|
63 | 63 | |
64 | 64 | return $this->selectWith($select)->current(); |
65 | 65 | } |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
71 | 71 | ->join( |
72 | 72 | 'category', 'category.category_uuid = articles.category_uuid', |
73 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left' |
|
73 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left' |
|
74 | 74 | ) |
75 | - ->where(['articles.slug' => $slug]); |
|
75 | + ->where([ 'articles.slug' => $slug ]); |
|
76 | 76 | |
77 | 77 | return $this->selectWith($select)->current(); |
78 | 78 | } |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | ->join( |
84 | 84 | 'articles', |
85 | 85 | 'article_events.article_uuid = articles.article_uuid', |
86 | - ['article_id', 'slug', 'published_at'] |
|
87 | - )->where(['articles.status' => 1]) |
|
88 | - ->order(['published_at' => 'desc']) |
|
86 | + [ 'article_id', 'slug', 'published_at' ] |
|
87 | + )->where([ 'articles.status' => 1 ]) |
|
88 | + ->order([ 'published_at' => 'desc' ]) |
|
89 | 89 | ->limit($limit); |
90 | 90 | |
91 | 91 | return $this->selectWith($select); |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | public function getFuture() |
95 | 95 | { |
96 | 96 | $select = $this->getSql()->select() |
97 | - ->where(['articles.status' => 1]) |
|
97 | + ->where([ 'articles.status' => 1 ]) |
|
98 | 98 | ->join( |
99 | 99 | 'articles', |
100 | 100 | 'articles.article_uuid = article_events.article_uuid', |
101 | - ['article_id', 'slug', 'published_at'] |
|
101 | + [ 'article_id', 'slug', 'published_at' ] |
|
102 | 102 | )->order(new Expression('rand()')); |
103 | 103 | |
104 | 104 | $select->where->greaterThanOrEqualTo('end_at', date('Y-m-d H:i:s')); |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | public function getPastSelect() |
110 | 110 | { |
111 | 111 | $select = $this->getSql()->select() |
112 | - ->where(['articles.status' => 1]) |
|
112 | + ->where([ 'articles.status' => 1 ]) |
|
113 | 113 | ->join( |
114 | 114 | 'articles', |
115 | 115 | 'articles.article_uuid = article_events.article_uuid', |
116 | - ['article_id', 'slug', 'published_at'] |
|
117 | - )->order(['start_at' => 'desc']); |
|
116 | + [ 'article_id', 'slug', 'published_at' ] |
|
117 | + )->order([ 'start_at' => 'desc' ]); |
|
118 | 118 | $select->where->lessThan('end_at', date('Y-m-d H:i:s')); |
119 | 119 | |
120 | 120 | return $select; |
@@ -54,7 +54,7 @@ |
||
54 | 54 | if (!$user) { |
55 | 55 | return $response->withStatus(302)->withHeader( |
56 | 56 | 'Location', |
57 | - $this->router->generateUri('auth', ['action' => 'login']) |
|
57 | + $this->router->generateUri('auth', [ 'action' => 'login' ]) |
|
58 | 58 | ); |
59 | 59 | } |
60 | 60 |
@@ -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 Admin\Factory\Service; |
6 | 6 | |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __invoke(ContainerInterface $container): AdminUserService |
23 | 23 | { |
24 | - $config = $container->get('config')['upload']; |
|
25 | - $upload = new Upload($config['public_path'], $config['non_public_path']); |
|
24 | + $config = $container->get('config')[ 'upload' ]; |
|
25 | + $upload = new Upload($config[ 'public_path' ], $config[ 'non_public_path' ]); |
|
26 | 26 | |
27 | 27 | return new AdminUserService( |
28 | 28 | new Bcrypt(), |
@@ -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') |
@@ -16,26 +16,26 @@ |
||
16 | 16 | public function testForSelectShouldReturnArray() |
17 | 17 | { |
18 | 18 | $categoryService = $this->getMockBuilder(\Category\Service\CategoryService::class) |
19 | - ->setMethods(['getAll']) |
|
19 | + ->setMethods([ 'getAll' ]) |
|
20 | 20 | ->disableOriginalConstructor() |
21 | 21 | ->getMockForAbstractClass(); |
22 | 22 | $categoryService->expects(static::once()) |
23 | 23 | ->method('getAll') |
24 | - ->willReturn([]); |
|
24 | + ->willReturn([ ]); |
|
25 | 25 | $categoryHelper = new \Category\View\Helper\CategoryHelper($categoryService); |
26 | - static::assertSame([], $categoryHelper->forSelect()); |
|
26 | + static::assertSame([ ], $categoryHelper->forSelect()); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function testForHomepageShouldReturnArray() |
30 | 30 | { |
31 | 31 | $categoryService = $this->getMockBuilder(\Category\Service\CategoryService::class) |
32 | - ->setMethods(['getCategoriesWithPosts']) |
|
32 | + ->setMethods([ 'getCategoriesWithPosts' ]) |
|
33 | 33 | ->disableOriginalConstructor() |
34 | 34 | ->getMockForAbstractClass(); |
35 | 35 | $categoryService->expects(static::once()) |
36 | 36 | ->method('getCategoriesWithPosts') |
37 | - ->willReturn([]); |
|
37 | + ->willReturn([ ]); |
|
38 | 38 | $categoryHelper = new \Category\View\Helper\CategoryHelper($categoryService); |
39 | - static::assertSame([], $categoryHelper->forHomepage()); |
|
39 | + static::assertSame([ ], $categoryHelper->forHomepage()); |
|
40 | 40 | } |
41 | 41 | } |
@@ -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') |
@@ -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') |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function testEditMethodShouldReturnHtmlResponseAndGetIdFromRequest() |
32 | 32 | { |
33 | 33 | $template = $this->getMockBuilder(\Zend\Expressive\Template\TemplateRendererInterface::class) |
34 | - ->setMethods(['render']) |
|
34 | + ->setMethods([ 'render' ]) |
|
35 | 35 | ->getMockForAbstractClass(); |
36 | 36 | $template->expects(static::once()) |
37 | 37 | ->method('render') |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $request = new \Zend\Diactoros\ServerRequest(); |
45 | 45 | $request = $request->withAttribute('action', 'edit'); |
46 | 46 | $request = $request->withAttribute('id', 1); |
47 | - $request = $request->withParsedBody(['menu' => 'test']); |
|
47 | + $request = $request->withParsedBody([ 'menu' => 'test' ]); |
|
48 | 48 | $response = new \Zend\Diactoros\Response(); |
49 | 49 | $indexController = new \Menu\Controller\IndexController( |
50 | 50 | $template, |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | ->will(static::returnValue('http://unfinished.dev/admin')); |
69 | 69 | $request = new \Zend\Diactoros\ServerRequest(); |
70 | 70 | $request = $request->withAttribute('action', 'save'); |
71 | - $request = $request->withParsedBody(['menu' => 'test']); |
|
71 | + $request = $request->withParsedBody([ 'menu' => 'test' ]); |
|
72 | 72 | $response = new \Zend\Diactoros\Response(); |
73 | 73 | $indexController = new \Menu\Controller\IndexController( |
74 | 74 | $template, |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $request = new \Zend\Diactoros\ServerRequest(); |
95 | 95 | $request = $request->withAttribute('action', 'save'); |
96 | 96 | $request = $request->withAttribute('id', 1); |
97 | - $request = $request->withParsedBody(['menu' => 'test']); |
|
97 | + $request = $request->withParsedBody([ 'menu' => 'test' ]); |
|
98 | 98 | $response = new \Zend\Diactoros\Response(); |
99 | 99 | $indexController = new \Menu\Controller\IndexController( |
100 | 100 | $template, |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | ->getMock(); |
118 | 118 | $menuService->expects(static::once()) |
119 | 119 | ->method('updateMenuItem') |
120 | - ->willThrowException(new \Std\FilterException(['test error'])); |
|
120 | + ->willThrowException(new \Std\FilterException([ 'test error' ])); |
|
121 | 121 | $router = $this->getMockBuilder(\Zend\Expressive\Router\RouterInterface::class) |
122 | 122 | ->getMockForAbstractClass(); |
123 | 123 | $request = new \Zend\Diactoros\ServerRequest(); |
124 | 124 | $request = $request->withAttribute('action', 'save'); |
125 | 125 | $request = $request->withAttribute('id', 2); |
126 | - $request = $request->withParsedBody(['menu' => 'test']); |
|
126 | + $request = $request->withParsedBody([ 'menu' => 'test' ]); |
|
127 | 127 | $response = new \Zend\Diactoros\Response(); |
128 | 128 | $indexController = new \Menu\Controller\IndexController( |
129 | 129 | $template, |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $request = new \Zend\Diactoros\ServerRequest(); |
156 | 156 | $request = $request->withAttribute('action', 'save'); |
157 | 157 | $request = $request->withAttribute('id', 2); |
158 | - $request = $request->withParsedBody(['menu' => 'test']); |
|
158 | + $request = $request->withParsedBody([ 'menu' => 'test' ]); |
|
159 | 159 | $response = new \Zend\Diactoros\Response(); |
160 | 160 | $indexController = new \Menu\Controller\IndexController( |
161 | 161 | $template, |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $request = new \Zend\Diactoros\ServerRequest(); |
235 | 235 | $request = $request->withAttribute('action', 'updateOrder'); |
236 | 236 | $request = $request->withAttribute('id', 2); |
237 | - $request = $request->withParsedBody(['menu' => 'test']); |
|
237 | + $request = $request->withParsedBody([ 'menu' => 'test' ]); |
|
238 | 238 | $response = new \Zend\Diactoros\Response(); |
239 | 239 | $indexController = new \Menu\Controller\IndexController( |
240 | 240 | $template, |
@@ -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') |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function testEditMethodShouldReturnHtmlResponseAndGetIdFromRequest() |
32 | 32 | { |
33 | 33 | $template = $this->getMockBuilder(\Zend\Expressive\Template\TemplateRendererInterface::class) |
34 | - ->setMethods(['render']) |
|
34 | + ->setMethods([ 'render' ]) |
|
35 | 35 | ->getMockForAbstractClass(); |
36 | 36 | $template->expects(static::once()) |
37 | 37 | ->method('render') |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $request = new \Zend\Diactoros\ServerRequest(); |
45 | 45 | $request = $request->withAttribute('action', 'edit'); |
46 | 46 | $request = $request->withAttribute('id', 1); |
47 | - $request = $request->withParsedBody(['category' => 'test']); |
|
47 | + $request = $request->withParsedBody([ 'category' => 'test' ]); |
|
48 | 48 | $response = new \Zend\Diactoros\Response(); |
49 | 49 | $indexController = new \Category\Controller\IndexController( |
50 | 50 | $template, |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | ->will(static::returnValue('http://unfinished.dev/admin')); |
69 | 69 | $request = new \Zend\Diactoros\ServerRequest(); |
70 | 70 | $request = $request->withAttribute('action', 'save'); |
71 | - $request = $request->withParsedBody(['category' => 'test']); |
|
71 | + $request = $request->withParsedBody([ 'category' => 'test' ]); |
|
72 | 72 | $response = new \Zend\Diactoros\Response(); |
73 | 73 | $indexController = new \Category\Controller\IndexController( |
74 | 74 | $template, |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $request = new \Zend\Diactoros\ServerRequest(); |
95 | 95 | $request = $request->withAttribute('action', 'save'); |
96 | 96 | $request = $request->withAttribute('id', 1); |
97 | - $request = $request->withParsedBody(['category' => 'test']); |
|
97 | + $request = $request->withParsedBody([ 'category' => 'test' ]); |
|
98 | 98 | $response = new \Zend\Diactoros\Response(); |
99 | 99 | $indexController = new \Category\Controller\IndexController( |
100 | 100 | $template, |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | ->getMock(); |
118 | 118 | $categoryService->expects(static::once()) |
119 | 119 | ->method('updateCategory') |
120 | - ->willThrowException(new \Std\FilterException(['test error'])); |
|
120 | + ->willThrowException(new \Std\FilterException([ 'test error' ])); |
|
121 | 121 | $router = $this->getMockBuilder(\Zend\Expressive\Router\RouterInterface::class) |
122 | 122 | ->getMockForAbstractClass(); |
123 | 123 | $request = new \Zend\Diactoros\ServerRequest(); |
124 | 124 | $request = $request->withAttribute('action', 'save'); |
125 | 125 | $request = $request->withAttribute('id', 2); |
126 | - $request = $request->withParsedBody(['category' => 'test']); |
|
126 | + $request = $request->withParsedBody([ 'category' => 'test' ]); |
|
127 | 127 | $response = new \Zend\Diactoros\Response(); |
128 | 128 | $indexController = new \Category\Controller\IndexController( |
129 | 129 | $template, |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $request = new \Zend\Diactoros\ServerRequest(); |
156 | 156 | $request = $request->withAttribute('action', 'save'); |
157 | 157 | $request = $request->withAttribute('id', 2); |
158 | - $request = $request->withParsedBody(['user' => 'test']); |
|
158 | + $request = $request->withParsedBody([ 'user' => 'test' ]); |
|
159 | 159 | $response = new \Zend\Diactoros\Response(); |
160 | 160 | $indexController = new \Category\Controller\IndexController( |
161 | 161 | $template, |
@@ -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') |