Completed
Pull Request — master (#114)
by
unknown
30:05
created
packages/Article/tests/View/Helper/EventHelperTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@
 block discarded – undo
16 16
     public function testAllShouldReturnArray()
17 17
     {
18 18
         $eventService = $this->getMockBuilder('Article\Service\EventService')
19
-            ->setMethods(['fetchLatest'])
19
+            ->setMethods([ 'fetchLatest' ])
20 20
             ->disableOriginalConstructor()
21 21
             ->getMockForAbstractClass();
22 22
         $eventService->expects(static::once())
23 23
             ->method('fetchLatest')
24
-            ->willReturn([]);
24
+            ->willReturn([ ]);
25 25
         $eventHelper = new \Article\View\Helper\EventHelper($eventService);
26
-        static::assertSame([], $eventHelper->getLatest());
26
+        static::assertSame([ ], $eventHelper->getLatest());
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
packages/Article/tests/Factory/View/Helper/EventHelperFactoryTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
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')
Please login to merge, or discard this patch.
packages/Admin/tests/Controller/UserControllerTest.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         /**
148 148
 * 
149 149
          *
150
- * @var \Zend\Diactoros\Response $returnedResponse 
150
+         * @var \Zend\Diactoros\Response $returnedResponse 
151 151
 */
152 152
         $returnedResponse = $userController($request, $response);
153 153
         static::assertSame(302, $returnedResponse->getStatusCode());
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         /**
187 187
 * 
188 188
          *
189
- * @var \Zend\Diactoros\Response $returnedResponse 
189
+         * @var \Zend\Diactoros\Response $returnedResponse 
190 190
 */
191 191
         $returnedResponse = $userController($request, $response);
192 192
         static::assertSame(302, $returnedResponse->getStatusCode());
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
         /**
229 229
 * 
230 230
          *
231
- * @var \Zend\Diactoros\Response $returnedResponse 
231
+         * @var \Zend\Diactoros\Response $returnedResponse 
232 232
 */
233 233
         $returnedResponse = $userController($request, $response);
234 234
         static::assertSame(200, $returnedResponse->getStatusCode());
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
         /**
304 304
 * 
305 305
          *
306
- * @var \Zend\Diactoros\Response $returnedResponse 
306
+         * @var \Zend\Diactoros\Response $returnedResponse 
307 307
 */
308 308
         $returnedResponse = $userController($request, $response);
309 309
         static::assertSame(302, $returnedResponse->getStatusCode());
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
         /**
346 346
 * 
347 347
          *
348
- * @var \Zend\Diactoros\Response $returnedResponse 
348
+         * @var \Zend\Diactoros\Response $returnedResponse 
349 349
 */
350 350
         $returnedResponse = $userController($request, $response);
351 351
         static::assertSame(302, $returnedResponse->getStatusCode());
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
         $sessionStorage = new \Zend\Session\Storage\ArrayStorage();
14 14
         $sessionStorage->user = $user;
15 15
         $template = $this->getMockBuilder(\Zend\Expressive\Template\TemplateRendererInterface::class)
16
-            ->setMethods(['render'])
16
+            ->setMethods([ 'render' ])
17 17
             ->getMockForAbstractClass();
18 18
         $template->expects(static::once())
19 19
             ->method('render')
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
             ->getMock();
24 24
         $sessionManager = $this->getMockBuilder(\Zend\Session\SessionManager::class)
25 25
             ->disableOriginalConstructor()
26
-            ->setMethods(['getStorage'])
26
+            ->setMethods([ 'getStorage' ])
27 27
             ->getMock();
28 28
         $sessionManager->expects(static::any())
29 29
             ->method('getStorage')
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
         $sessionStorage = new \Zend\Session\Storage\ArrayStorage();
50 50
         $sessionStorage->user = $user;
51 51
         $template = $this->getMockBuilder(\Zend\Expressive\Template\TemplateRendererInterface::class)
52
-            ->setMethods(['render'])
52
+            ->setMethods([ 'render' ])
53 53
             ->getMockForAbstractClass();
54 54
         $template->expects(static::once())
55 55
             ->method('render')
56 56
             ->will(static::returnValue('test'));
57 57
         $adminUserService = $this->getMockBuilder(\Admin\Service\AdminUserService::class)
58 58
             ->disableOriginalConstructor()
59
-            ->setMethods(['getUser'])
59
+            ->setMethods([ 'getUser' ])
60 60
             ->getMock();
61 61
         $adminUserService->expects(static::once())
62 62
             ->method('getUser')
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
         $sessionStorage = new \Zend\Session\Storage\ArrayStorage();
87 87
         $sessionStorage->user = $user;
88 88
         $template = $this->getMockBuilder(\Zend\Expressive\Template\TemplateRendererInterface::class)
89
-            ->setMethods(['render'])
89
+            ->setMethods([ 'render' ])
90 90
             ->getMockForAbstractClass();
91 91
         $template->expects(static::once())
92 92
             ->method('render')
93 93
             ->will(static::returnValue('test'));
94 94
         $adminUserService = $this->getMockBuilder(\Admin\Service\AdminUserService::class)
95 95
             ->disableOriginalConstructor()
96
-            ->setMethods(['getUser'])
96
+            ->setMethods([ 'getUser' ])
97 97
             ->getMock();
98 98
         $adminUserService->expects(static::once())
99 99
             ->method('getUser')
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $request = new \Zend\Diactoros\ServerRequest();
107 107
         $request = $request->withAttribute('action', 'edit');
108 108
         $request = $request->withAttribute('id', 1);
109
-        $request = $request->withParsedBody(['user' => 'test']);
109
+        $request = $request->withParsedBody([ 'user' => 'test' ]);
110 110
         $response = new \Zend\Diactoros\Response();
111 111
         $userController = new \Admin\Controller\UserController(
112 112
             $template,
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             ->will(static::returnValue('http://unfinished.dev/admin/users'));
139 139
         $request = new \Zend\Diactoros\ServerRequest();
140 140
         $request = $request->withAttribute('action', 'save');
141
-        $request = $request->withParsedBody(['user' => 'test']);
141
+        $request = $request->withParsedBody([ 'user' => 'test' ]);
142 142
         $response = new \Zend\Diactoros\Response();
143 143
         $userController = new \Admin\Controller\UserController(
144 144
             $template,
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         $request = new \Zend\Diactoros\ServerRequest();
178 178
         $request = $request->withAttribute('action', 'save');
179 179
         $request = $request->withAttribute('id', 2);
180
-        $request = $request->withParsedBody(['user' => 'test']);
180
+        $request = $request->withParsedBody([ 'user' => 'test' ]);
181 181
         $response = new \Zend\Diactoros\Response();
182 182
         $userController = new \Admin\Controller\UserController(
183 183
             $template,
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
             ->getMockForAbstractClass();
216 216
         $router->expects(static::at(0))
217 217
             ->method('generateUri')
218
-            ->willThrowException(new \Std\FilterException(['test error']));
218
+            ->willThrowException(new \Std\FilterException([ 'test error' ]));
219 219
         $request = new \Zend\Diactoros\ServerRequest();
220 220
         $request = $request->withAttribute('action', 'save');
221 221
         $request = $request->withAttribute('id', 2);
222
-        $request = $request->withParsedBody(['user' => 'test']);
222
+        $request = $request->withParsedBody([ 'user' => 'test' ]);
223 223
         $response = new \Zend\Diactoros\Response();
224 224
         $userController = new \Admin\Controller\UserController(
225 225
             $template,
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
             ->willThrowException(new \Exception('test error'));
263 263
         $request = new \Zend\Diactoros\ServerRequest();
264 264
         $request = $request->withAttribute('action', 'save');
265
-        $request = $request->withParsedBody(['user' => 'test']);
265
+        $request = $request->withParsedBody([ 'user' => 'test' ]);
266 266
         $response = new \Zend\Diactoros\Response();
267 267
         $userController = new \Admin\Controller\UserController(
268 268
             $template,
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         $template = $this->getMockBuilder(\Zend\Expressive\Template\TemplateRendererInterface::class)
321 321
             ->getMockForAbstractClass();
322 322
         $adminUserService = $this->getMockBuilder(\Admin\Service\AdminUserService::class)
323
-            ->setMethods(['delete'])
323
+            ->setMethods([ 'delete' ])
324 324
             ->disableOriginalConstructor()
325 325
             ->getMock();
326 326
         $adminUserService->expects(static::once())
Please login to merge, or discard this patch.
packages/Category/src/Controller/IndexController.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
     public function index() : \Psr\Http\Message\ResponseInterface
61 61
     {
62 62
         $params = $this->request->getQueryParams();
63
-        $page   = isset($params['page']) ? $params['page'] : 1;
64
-        $limit  = isset($params['limit']) ? $params['limit'] : 15;
63
+        $page   = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
64
+        $limit  = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15;
65 65
 
66 66
         $categories = $this->categoryService->getPagination($page, $limit);
67 67
 
68
-        return new HtmlResponse($this->template->render('category::index/index', ['list' => $categories, 'layout' => 'layout/admin']));
68
+        return new HtmlResponse($this->template->render('category::index/index', [ 'list' => $categories, 'layout' => 'layout/admin' ]));
69 69
     }
70 70
 
71 71
     /**
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
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
         $category = $this->categoryService->getCategory($id);
80 80
 
81
-        if($this->request->getParsedBody()) {
82
-            $category              = (object)($this->request->getParsedBody() + (array)$category);
81
+        if ($this->request->getParsedBody()) {
82
+            $category              = (object) ($this->request->getParsedBody() + (array) $category);
83 83
             $category->category_id = $id;
84 84
         }
85 85
 
@@ -96,37 +96,37 @@  discard block
 block discarded – undo
96 96
 
97 97
     public function save()
98 98
     {
99
-        try{
99
+        try {
100 100
             $id   = $this->request->getAttribute('id');
101 101
             $data = $this->request->getParsedBody();
102 102
             $data += (new Request())->getFiles()->toArray();
103 103
 
104
-            if($id) {
104
+            if ($id) {
105 105
                 $this->categoryService->updateCategory($data, $id);
106 106
             }
107
-            else{
107
+            else {
108 108
                 $this->categoryService->createCategory($data);
109 109
             }
110 110
 
111 111
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories'));
112 112
         }
113
-        catch(FilterException $fe){
113
+        catch (FilterException $fe) {
114 114
             return $this->edit($fe->getArrayMessages());
115 115
         }
116
-        catch(\Exception $e){
116
+        catch (\Exception $e) {
117 117
             throw $e;
118 118
         }
119 119
     }
120 120
 
121 121
     public function delete()
122 122
     {
123
-        try{
123
+        try {
124 124
             $id = $this->request->getAttribute('id');
125 125
             $this->categoryService->delete($id);
126 126
 
127 127
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories'));
128 128
         }
129
-        catch(\Exception $e){
129
+        catch (\Exception $e) {
130 130
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories'));
131 131
         }
132 132
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -103,17 +103,14 @@  discard block
 block discarded – undo
103 103
 
104 104
             if($id) {
105 105
                 $this->categoryService->updateCategory($data, $id);
106
-            }
107
-            else{
106
+            } else{
108 107
                 $this->categoryService->createCategory($data);
109 108
             }
110 109
 
111 110
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories'));
112
-        }
113
-        catch(FilterException $fe){
111
+        } catch(FilterException $fe){
114 112
             return $this->edit($fe->getArrayMessages());
115
-        }
116
-        catch(\Exception $e){
113
+        } catch(\Exception $e){
117 114
             throw $e;
118 115
         }
119 116
     }
@@ -125,8 +122,7 @@  discard block
 block discarded – undo
125 122
             $this->categoryService->delete($id);
126 123
 
127 124
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories'));
128
-        }
129
-        catch(\Exception $e){
125
+        } catch(\Exception $e){
130 126
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories'));
131 127
         }
132 128
     }
Please login to merge, or discard this patch.
packages/Category/src/Filter/CategoryFilter.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,17 +12,17 @@  discard block
 block discarded – undo
12 12
 
13 13
     public function getInputFilter()
14 14
     {
15
-        if(!$this->inputFilter) {
15
+        if (!$this->inputFilter) {
16 16
             $inputFilter = new InputFilter();
17 17
 
18 18
             $inputFilter->add(
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
packages/Page/src/Mapper/PageMapper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,6 +35,6 @@
 block discarded – undo
35 35
 
36 36
     public function getActivePage($urlSlug)
37 37
     {
38
-        return $this->select(['slug' => $urlSlug, 'is_active' => true]);
38
+        return $this->select([ 'slug' => $urlSlug, 'is_active' => true ]);
39 39
     }
40 40
 }
Please login to merge, or discard this patch.
packages/Page/src/Filter/PageFilter.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
             [
19 19
             'name'       => 'title',
20 20
             'required'   => true,
21
-            'filters'    => [['name' => 'StringTrim']],
21
+            'filters'    => [ [ 'name' => 'StringTrim' ] ],
22 22
             'validators' => [
23
-                ['name' => 'NotEmpty'],
24
-                ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]],
23
+                [ 'name' => 'NotEmpty' ],
24
+                [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ],
25 25
             ],
26 26
             ]
27 27
         );
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
             [
31 31
             'name'       => 'slug',
32 32
             'required'   => true,
33
-            'filters'    => [['name' => 'StringTrim']],
33
+            'filters'    => [ [ 'name' => 'StringTrim' ] ],
34 34
             'validators' => [
35
-                ['name' => 'NotEmpty'],
36
-                ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]],
35
+                [ 'name' => 'NotEmpty' ],
36
+                [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ],
37 37
             ],
38 38
             ]
39 39
         );
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
             [
43 43
             'name'       => 'body',
44 44
             'required'   => true,
45
-            'filters'    => [['name' => 'StringTrim']],
45
+            'filters'    => [ [ 'name' => 'StringTrim' ] ],
46 46
             'validators' => [
47
-                ['name' => 'NotEmpty'],
48
-                ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100000]],
47
+                [ 'name' => 'NotEmpty' ],
48
+                [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100000 ] ],
49 49
             ],
50 50
             ]
51 51
         );
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
             [
55 55
             'name'       => 'description',
56 56
             'required'   => true,
57
-            'filters'    => [['name' => 'StringTrim']],
57
+            'filters'    => [ [ 'name' => 'StringTrim' ] ],
58 58
             'validators' => [
59
-                ['name' => 'NotEmpty'],
60
-                ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 50000]],
59
+                [ 'name' => 'NotEmpty' ],
60
+                [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 50000 ] ],
61 61
             ],
62 62
             ]
63 63
         );
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             [
67 67
             'name'     => 'has_layout',
68 68
             'required' => false,
69
-            'filters'  => [['name' => 'Boolean']],
69
+            'filters'  => [ [ 'name' => 'Boolean' ] ],
70 70
             ]
71 71
         );
72 72
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             [
75 75
             'name'     => 'is_homepage',
76 76
             'required' => false,
77
-            'filters'  => [['name' => 'Boolean']],
77
+            'filters'  => [ [ 'name' => 'Boolean' ] ],
78 78
             ]
79 79
         );
80 80
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             [
83 83
             'name'     => 'is_active',
84 84
             'required' => false,
85
-            'filters'  => [['name' => 'Boolean']],
85
+            'filters'  => [ [ 'name' => 'Boolean' ] ],
86 86
             ]
87 87
         );
88 88
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             [
91 91
             'name'     => 'is_wysiwyg_editor',
92 92
             'required' => false,
93
-            'filters'  => [['name' => 'Boolean']],
93
+            'filters'  => [ [ 'name' => 'Boolean' ] ],
94 94
             ]
95 95
         );
96 96
 
Please login to merge, or discard this patch.
packages/Page/src/Service/PageServiceFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
     public function __invoke(ContainerInterface $container)
15 15
     {
16 16
 
17
-        $config = $container->get('config')['upload'];
18
-        $upload = new Upload($config['public_path'], $config['non_public_path']);
17
+        $config = $container->get('config')[ 'upload' ];
18
+        $upload = new Upload($config[ 'public_path' ], $config[ 'non_public_path' ]);
19 19
 
20 20
         // Create pagination object
21 21
         $pageMapper        = $container->get(PageMapper::class);
Please login to merge, or discard this patch.
packages/Page/src/Service/PageService.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
             + ['main_img' => $this->upload->uploadImage($data, 'main_img')];
78 78
         $data['page_id'] = Uuid::uuid1()->toString();
79 79
         $data['page_uuid']
80
-                         = (new MysqlUuid($data['page_id']))->toFormat(new Binary);
80
+                            = (new MysqlUuid($data['page_id']))->toFormat(new Binary);
81 81
 
82 82
         if($data['is_homepage']){
83 83
             $this->pageMapper->update(['is_homepage' => false]);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,8 +104,7 @@
 block discarded – undo
104 104
         // We don't want to force user to re-upload image on edit
105 105
         if(!$data['main_img']){
106 106
             unset($data['main_img']);
107
-        }
108
-        else{
107
+        } else{
109 108
             $this->upload->deleteFile($page->getMainImg());
110 109
         }
111 110
 
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function getPage($pageId)
42 42
     {
43
-        return $this->pageMapper->select(['page_id' => $pageId])->current();
43
+        return $this->pageMapper->select([ 'page_id' => $pageId ])->current();
44 44
     }
45 45
 
46 46
     /**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function getHomepage()
59 59
     {
60
-        return $this->pageMapper->select(['is_homepage' => true])->current();
60
+        return $this->pageMapper->select([ 'is_homepage' => true ])->current();
61 61
     }
62 62
 
63 63
     /**
@@ -69,18 +69,18 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $filter = $this->pageFilter->getInputFilter()->setData($data);
71 71
 
72
-        if(!$filter->isValid()){
72
+        if (!$filter->isValid()) {
73 73
             throw new FilterException($filter->getMessages());
74 74
         }
75 75
 
76 76
         $data            = $filter->getValues()
77
-            + ['main_img' => $this->upload->uploadImage($data, 'main_img')];
78
-        $data['page_id'] = Uuid::uuid1()->toString();
79
-        $data['page_uuid']
80
-                         = (new MysqlUuid($data['page_id']))->toFormat(new Binary);
77
+            + [ 'main_img' => $this->upload->uploadImage($data, 'main_img') ];
78
+        $data[ 'page_id' ] = Uuid::uuid1()->toString();
79
+        $data[ 'page_uuid' ]
80
+                         = (new MysqlUuid($data[ 'page_id' ]))->toFormat(new Binary);
81 81
 
82
-        if($data['is_homepage']){
83
-            $this->pageMapper->update(['is_homepage' => false]);
82
+        if ($data[ 'is_homepage' ]) {
83
+            $this->pageMapper->update([ 'is_homepage' => false ]);
84 84
         }
85 85
 
86 86
         return $this->pageMapper->insert($data);
@@ -88,43 +88,43 @@  discard block
 block discarded – undo
88 88
 
89 89
     public function updatePage($data, $pageId)
90 90
     {
91
-        if(!($page = $this->getPage($pageId))){
91
+        if (!($page = $this->getPage($pageId))) {
92 92
             throw new \Exception('Page object not found. Page ID:' . $pageId);
93 93
         }
94 94
 
95 95
         $filter = $this->pageFilter->getInputFilter()->setData($data);
96 96
 
97
-        if(!$filter->isValid()){
97
+        if (!$filter->isValid()) {
98 98
             throw new FilterException($filter->getMessages());
99 99
         }
100 100
 
101 101
         $data = $filter->getValues()
102
-            + ['main_img' => $this->upload->uploadImage($data, 'main_img')];
102
+            + [ 'main_img' => $this->upload->uploadImage($data, 'main_img') ];
103 103
 
104 104
         // We don't want to force user to re-upload image on edit
105
-        if(!$data['main_img']){
106
-            unset($data['main_img']);
105
+        if (!$data[ 'main_img' ]) {
106
+            unset($data[ 'main_img' ]);
107 107
         }
108
-        else{
108
+        else {
109 109
             $this->upload->deleteFile($page->getMainImg());
110 110
         }
111 111
 
112
-        if($data['is_homepage']){
113
-            $this->pageMapper->update(['is_homepage' => false]);
112
+        if ($data[ 'is_homepage' ]) {
113
+            $this->pageMapper->update([ 'is_homepage' => false ]);
114 114
         }
115 115
 
116
-        return $this->pageMapper->update($data, ['page_id' => $pageId]);
116
+        return $this->pageMapper->update($data, [ 'page_id' => $pageId ]);
117 117
     }
118 118
 
119 119
     public function delete($pageId)
120 120
     {
121
-        if(!($page = $this->getPage($pageId))){
121
+        if (!($page = $this->getPage($pageId))) {
122 122
             throw new \Exception('Page not found');
123 123
         }
124 124
 
125 125
         $this->upload->deleteFile($page->getMainImg());
126 126
 
127
-        return (bool)$this->pageMapper->delete(['page_id' => $pageId]);
127
+        return (bool) $this->pageMapper->delete([ 'page_id' => $pageId ]);
128 128
     }
129 129
 
130 130
     public function getForSelect()
Please login to merge, or discard this patch.