@@ -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 | /** |
@@ -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,10 +43,10 @@ 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 | ); |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | [ |
56 | 56 | 'name' => 'description', |
57 | 57 | 'required' => false, |
58 | - 'filters' => [['name' => 'StringTrim']], |
|
58 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
59 | 59 | 'validators' => [ |
60 | - ['name' => 'NotEmpty'], |
|
61 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 1000]], |
|
60 | + [ 'name' => 'NotEmpty' ], |
|
61 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 1000 ] ], |
|
62 | 62 | ], |
63 | 63 | ] |
64 | 64 | ); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | [ |
68 | 68 | 'name' => 'is_in_homepage', |
69 | 69 | 'required' => false, |
70 | - 'filters' => [['name' => 'Boolean']], |
|
70 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
71 | 71 | ] |
72 | 72 | ); |
73 | 73 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | [ |
76 | 76 | 'name' => 'is_in_category_list', |
77 | 77 | 'required' => false, |
78 | - 'filters' => [['name' => 'Boolean']], |
|
78 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
79 | 79 | ] |
80 | 80 | ); |
81 | 81 |
@@ -11,11 +11,11 @@ |
||
11 | 11 | $categoryMapper = $this->getMockBuilder(\Category\Mapper\CategoryMapper::class) |
12 | 12 | ->getMockForAbstractClass(); |
13 | 13 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
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($categoryMapper)); |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | public $admin_user_id = '123'; |
14 | 14 | }; |
15 | 15 | $bcrypt = $this->getMockBuilder(\Zend\Crypt\Password\Bcrypt::class) |
16 | - ->setMethods(['verify']) |
|
16 | + ->setMethods([ 'verify' ]) |
|
17 | 17 | ->getMock(); |
18 | 18 | $bcrypt->expects(static::once()) |
19 | 19 | ->method('verify') |
20 | 20 | ->will(static::returnValue(true)); |
21 | 21 | $adminUsersMapper = $this->getMockBuilder(\Admin\Mapper\AdminUsersMapper::class) |
22 | - ->setMethods(['getByEmail', 'updateLogin']) |
|
22 | + ->setMethods([ 'getByEmail', 'updateLogin' ]) |
|
23 | 23 | ->getMock(); |
24 | 24 | $adminUsersMapper->expects(static::once()) |
25 | 25 | ->method('updateLogin') |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | public $admin_user_uuid = 'uuid'; |
50 | 50 | }; |
51 | 51 | $bcrypt = $this->getMockBuilder(\Zend\Crypt\Password\Bcrypt::class) |
52 | - ->setMethods(['verify']) |
|
52 | + ->setMethods([ 'verify' ]) |
|
53 | 53 | ->getMock(); |
54 | 54 | $bcrypt->expects(static::once()) |
55 | 55 | ->method('verify') |
56 | 56 | ->will(static::returnValue(false)); |
57 | 57 | $adminUsersMapper = $this->getMockBuilder(\Admin\Mapper\AdminUsersMapper::class) |
58 | - ->setMethods(['getByEmail']) |
|
58 | + ->setMethods([ 'getByEmail' ]) |
|
59 | 59 | ->getMock(); |
60 | 60 | $adminUsersMapper->expects(static::once()) |
61 | 61 | ->method('getByEmail') |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $bcrypt = $this->getMockBuilder(\Zend\Crypt\Password\Bcrypt::class) |
81 | 81 | ->getMock(); |
82 | 82 | $adminUsersMapper = $this->getMockBuilder(\Admin\Mapper\AdminUsersMapper::class) |
83 | - ->setMethods(['getByEmail']) |
|
83 | + ->setMethods([ 'getByEmail' ]) |
|
84 | 84 | ->getMock(); |
85 | 85 | $adminUsersMapper->expects(static::once()) |
86 | 86 | ->method('getByEmail') |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | { |
9 | 9 | $session = new \Zend\Session\SessionManager(); |
10 | 10 | $router = $this->getMockBuilder('Zend\Expressive\Router\RouterInterface') |
11 | - ->setMethods(['generateUri']) |
|
11 | + ->setMethods([ 'generateUri' ]) |
|
12 | 12 | ->getMockForAbstractClass(); |
13 | 13 | $router->expects(static::at(0)) |
14 | 14 | ->method('generateUri') |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | $response = new \Zend\Diactoros\Response(); |
18 | 18 | $adminAuthMiddleware = new \Admin\Middleware\AdminAuth($router, $session); |
19 | 19 | /** @var \Zend\Diactoros\Response $response */ |
20 | - $response = $adminAuthMiddleware($request, $response, function ($request, $response) { |
|
20 | + $response = $adminAuthMiddleware($request, $response, function($request, $response) { |
|
21 | 21 | |
22 | 22 | }); |
23 | 23 | static::assertSame(302, $response->getStatusCode()); |
24 | - static::assertSame(['http://unfinished.dev/admin/login'], $response->getHeader('Location')); |
|
24 | + static::assertSame([ 'http://unfinished.dev/admin/login' ], $response->getHeader('Location')); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function testExecutionShouldContinueFurtherIfUserIsLoggedIn() |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $request = new \Zend\Diactoros\ServerRequest(); |
40 | 40 | $response = new \Zend\Diactoros\Response(); |
41 | 41 | $adminAuthMiddleware = new \Admin\Middleware\AdminAuth($router, $session); |
42 | - $middlewareResponse = $adminAuthMiddleware($request, $response, function ($request, $response) { |
|
42 | + $middlewareResponse = $adminAuthMiddleware($request, $response, function($request, $response) { |
|
43 | 43 | return $response; |
44 | 44 | }); |
45 | 45 | static::assertSame($response, $middlewareResponse); |
@@ -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; |