Completed
Pull Request — master (#97)
by Aleksandar
46:22 queued 13:15
created
packages/Page/src/Service/PageService.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -39,23 +39,23 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function getPage($pageId)
41 41
     {
42
-        return $this->pageMapper->select(['page_id' => $pageId])->current();
42
+        return $this->pageMapper->select([ 'page_id' => $pageId ])->current();
43 43
     }
44 44
 
45 45
     public function createPage($data)
46 46
     {
47 47
         $filter = $this->pageFilter->getInputFilter()->setData($data);
48 48
 
49
-        if(!$filter->isValid()) {
49
+        if (!$filter->isValid()) {
50 50
             throw new FilterException($filter->getMessages());
51 51
         }
52 52
 
53
-        $data              = $filter->getValues() + ['main_img' => $this->upload->uploadImage($data, 'main_img')];
54
-        $data['page_id']   = Uuid::uuid1()->toString();
55
-        $data['page_uuid'] = (new MysqlUuid($data['page_id']))->toFormat(new Binary);
53
+        $data              = $filter->getValues() + [ 'main_img' => $this->upload->uploadImage($data, 'main_img') ];
54
+        $data[ 'page_id' ]   = Uuid::uuid1()->toString();
55
+        $data[ 'page_uuid' ] = (new MysqlUuid($data[ 'page_id' ]))->toFormat(new Binary);
56 56
 
57
-        if($data['is_homepage']) {
58
-            $this->pageMapper->update(['is_homepage' => false]);
57
+        if ($data[ 'is_homepage' ]) {
58
+            $this->pageMapper->update([ 'is_homepage' => false ]);
59 59
         }
60 60
 
61 61
         return $this->pageMapper->insert($data);
@@ -63,32 +63,32 @@  discard block
 block discarded – undo
63 63
 
64 64
     public function updatePage($data, $pageId)
65 65
     {
66
-        if(!($page = $this->getPage($pageId))) {
66
+        if (!($page = $this->getPage($pageId))) {
67 67
             throw new \Exception('Page object not found. Page ID:' . $pageId);
68 68
         }
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
-        $data = $filter->getValues() + ['main_img' => $this->upload->uploadImage($data, 'main_img'),];
76
+        $data = $filter->getValues() + [ 'main_img' => $this->upload->uploadImage($data, 'main_img'), ];
77 77
 
78 78
         // We don't want to force user to re-upload image on edit
79
-        if(!$data['main_img']) {
80
-            unset($data['main_img']);
79
+        if (!$data[ 'main_img' ]) {
80
+            unset($data[ 'main_img' ]);
81 81
         }
82 82
 
83
-        if($data['is_homepage']) {
84
-            $this->pageMapper->update(['is_homepage' => false]);
83
+        if ($data[ 'is_homepage' ]) {
84
+            $this->pageMapper->update([ 'is_homepage' => false ]);
85 85
         }
86 86
 
87
-        return $this->pageMapper->update($data, ['page_id' => $pageId]);
87
+        return $this->pageMapper->update($data, [ 'page_id' => $pageId ]);
88 88
     }
89 89
 
90 90
     public function delete($pageId)
91 91
     {
92
-        return (bool)$this->pageMapper->delete(['page_id' => $pageId]);
92
+        return (bool) $this->pageMapper->delete([ 'page_id' => $pageId ]);
93 93
     }
94 94
 }
95 95
\ No newline at end of file
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
@@ -11,8 +11,8 @@
 block discarded – undo
11 11
 {
12 12
     public function __invoke(ContainerInterface $container)
13 13
     {
14
-        $config = $container->get('config')['upload'];
15
-        $upload = new Upload($config['public_path'], $config['non_public_path']);
14
+        $config = $container->get('config')[ 'upload' ];
15
+        $upload = new Upload($config[ 'public_path' ], $config[ 'non_public_path' ]);
16 16
 
17 17
         return new PageService(
18 18
             $container->get(PageMapper::class),
Please login to merge, or discard this patch.
packages/Page/src/Controller/PageController.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
     public function index(): HtmlResponse
40 40
     {
41 41
         $params     = $this->request->getQueryParams();
42
-        $page       = isset($params['page']) ? $params['page'] : 1;
43
-        $limit      = isset($params['limit']) ? $params['limit'] : 15;
42
+        $page       = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
43
+        $limit      = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15;
44 44
         $pagination = $this->pageService->getPagination($page, $limit);
45 45
 
46 46
         return new HtmlResponse($this->template->render('page::index', [
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
         ]));
50 50
     }
51 51
 
52
-    public function edit($errors = []): HtmlResponse
52
+    public function edit($errors = [ ]): HtmlResponse
53 53
     {
54 54
         $id   = $this->request->getAttribute('id');
55 55
         $page = $this->pageService->getPage($id);
56 56
 
57
-        if($this->request->getParsedBody()) {
57
+        if ($this->request->getParsedBody()) {
58 58
             $page = new \Page\Entity\Page();
59
-            $page->exchangeArray($this->request->getParsedBody() + (array)$page);
59
+            $page->exchangeArray($this->request->getParsedBody() + (array) $page);
60 60
         }
61 61
 
62 62
         return new HtmlResponse($this->template->render('page::edit', [
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
         try {
72 72
             $pageId = $this->request->getAttribute('id');
73 73
             $data   = $this->request->getParsedBody();
74
-            $data   += (new Request())->getFiles()->toArray();
74
+            $data += (new Request())->getFiles()->toArray();
75 75
 
76
-            if($pageId) {
76
+            if ($pageId) {
77 77
                 $this->pageService->updatePage($data, $pageId);
78 78
             }
79 79
             else {
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 
83 83
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages'));
84 84
         }
85
-        catch(FilterException $fe) {
85
+        catch (FilterException $fe) {
86 86
             return $this->edit($fe->getArrayMessages());
87 87
         }
88
-        catch(\Exception $e) {
88
+        catch (\Exception $e) {
89 89
             throw $e;
90 90
         }
91 91
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages'));
100 100
         }
101
-        catch(\Exception $e) {
101
+        catch (\Exception $e) {
102 102
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages'));
103 103
         }
104 104
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -75,17 +75,14 @@  discard block
 block discarded – undo
75 75
 
76 76
             if($pageId) {
77 77
                 $this->pageService->updatePage($data, $pageId);
78
-            }
79
-            else {
78
+            } else {
80 79
                 $this->pageService->createPage($data);
81 80
             }
82 81
 
83 82
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages'));
84
-        }
85
-        catch(FilterException $fe) {
83
+        } catch(FilterException $fe) {
86 84
             return $this->edit($fe->getArrayMessages());
87
-        }
88
-        catch(\Exception $e) {
85
+        } catch(\Exception $e) {
89 86
             throw $e;
90 87
         }
91 88
     }
@@ -97,8 +94,7 @@  discard block
 block discarded – undo
97 94
             $this->pageService->delete($pageId);
98 95
 
99 96
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages'));
100
-        }
101
-        catch(\Exception $e) {
97
+        } catch(\Exception $e) {
102 98
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.pages'));
103 99
         }
104 100
     }
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
@@ -17,65 +17,65 @@
 block discarded – undo
17 17
         $inputFilter->add([
18 18
             'name'       => 'title',
19 19
             'required'   => true,
20
-            'filters'    => [['name' => 'StringTrim']],
20
+            'filters'    => [ [ 'name' => 'StringTrim' ] ],
21 21
             'validators' => [
22
-                ['name' => 'NotEmpty'],
23
-                ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]],
22
+                [ 'name' => 'NotEmpty' ],
23
+                [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ],
24 24
             ],
25 25
         ]);
26 26
 
27 27
         $inputFilter->add([
28 28
             'name'       => 'slug',
29 29
             'required'   => true,
30
-            'filters'    => [['name' => 'StringTrim']],
30
+            'filters'    => [ [ 'name' => 'StringTrim' ] ],
31 31
             'validators' => [
32
-                ['name' => 'NotEmpty'],
33
-                ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]],
32
+                [ 'name' => 'NotEmpty' ],
33
+                [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ],
34 34
             ],
35 35
         ]);
36 36
 
37 37
         $inputFilter->add([
38 38
             'name'       => 'body',
39 39
             'required'   => true,
40
-            'filters'    => [['name' => 'StringTrim']],
40
+            'filters'    => [ [ 'name' => 'StringTrim' ] ],
41 41
             'validators' => [
42
-                ['name' => 'NotEmpty'],
43
-                ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100000]],
42
+                [ 'name' => 'NotEmpty' ],
43
+                [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100000 ] ],
44 44
             ],
45 45
         ]);
46 46
 
47 47
         $inputFilter->add([
48 48
             'name'       => 'description',
49 49
             'required'   => true,
50
-            'filters'    => [['name' => 'StringTrim']],
50
+            'filters'    => [ [ 'name' => 'StringTrim' ] ],
51 51
             'validators' => [
52
-                ['name' => 'NotEmpty'],
53
-                ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 50000]],
52
+                [ 'name' => 'NotEmpty' ],
53
+                [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 50000 ] ],
54 54
             ],
55 55
         ]);
56 56
 
57 57
         $inputFilter->add([
58 58
             'name'     => 'has_layout',
59 59
             'required' => false,
60
-            'filters'  => [['name' => 'Boolean']],
60
+            'filters'  => [ [ 'name' => 'Boolean' ] ],
61 61
         ]);
62 62
 
63 63
         $inputFilter->add([
64 64
             'name'     => 'is_homepage',
65 65
             'required' => false,
66
-            'filters'  => [['name' => 'Boolean']],
66
+            'filters'  => [ [ 'name' => 'Boolean' ] ],
67 67
         ]);
68 68
 
69 69
         $inputFilter->add([
70 70
             'name'     => 'is_active',
71 71
             'required' => false,
72
-            'filters'  => [['name' => 'Boolean']],
72
+            'filters'  => [ [ 'name' => 'Boolean' ] ],
73 73
         ]);
74 74
 
75 75
         $inputFilter->add([
76 76
             'name'     => 'is_wysiwyg_editor',
77 77
             'required' => false,
78
-            'filters'  => [['name' => 'Boolean']],
78
+            'filters'  => [ [ 'name' => 'Boolean' ] ],
79 79
         ]);
80 80
 
81 81
         return $inputFilter;
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
@@ -25,6 +25,6 @@
 block discarded – undo
25 25
 
26 26
     public function getPaginationSelect()
27 27
     {
28
-        return $this->getSql()->select()->order(['is_homepage' => 'desc', 'created_at' => 'desc']);
28
+        return $this->getSql()->select()->order([ 'is_homepage' => 'desc', 'created_at' => 'desc' ]);
29 29
     }
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
packages/Page/src/ConfigProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
                     'page/pagination' => __DIR__ . '/../templates/partial/pagination.php',
15 15
                 ],
16 16
                 'paths' => [
17
-                    'page' => [__DIR__ . '/../templates/page'],
17
+                    'page' => [ __DIR__ . '/../templates/page' ],
18 18
                 ],
19 19
             ],
20 20
 
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
                     'name'            => 'admin.pages',
33 33
                     'path'            => '/admin/pages',
34 34
                     'middleware'      => Controller\PageController::class,
35
-                    'allowed_methods' => ['GET'],
35
+                    'allowed_methods' => [ 'GET' ],
36 36
                 ],
37 37
                 [
38 38
                     'name'            => 'admin.pages.action',
39 39
                     'path'            => '/admin/pages/:action/:id',
40 40
                     'middleware'      => Controller\PageController::class,
41
-                    'allowed_methods' => ['GET', 'POST']
41
+                    'allowed_methods' => [ 'GET', 'POST' ]
42 42
                 ]
43 43
             ],
44 44
         ];
Please login to merge, or discard this patch.
packages/Page/src/Entity/Page.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function getDescription($limit = null)
112 112
     {
113
-        if(!$limit) {
113
+        if (!$limit) {
114 114
             return $this->description;
115 115
         }
116 116
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function getCreatedAt($format = null)
167 167
     {
168
-        if(!$format) {
168
+        if (!$format) {
169 169
             return $this->created_at;
170 170
         }
171 171
 
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
      *
184 184
      * @param array $data
185 185
      */
186
-    public function exchangeArray($data = [])
186
+    public function exchangeArray($data = [ ])
187 187
     {
188
-        foreach(array_keys(get_object_vars($this)) as $property) {
189
-            $this->{$property} = isset($data[$property]) ? $data[$property] : null;
188
+        foreach (array_keys(get_object_vars($this)) as $property) {
189
+            $this->{$property} = isset($data[ $property ]) ? $data[ $property ] : null;
190 190
         }
191 191
     }
192 192
 
@@ -194,18 +194,18 @@  discard block
 block discarded – undo
194 194
     public function getArrayCopy()
195 195
     {
196 196
         return [
197
-            'page_uuid'         => (binary)$this->page_uuid,
198
-            'page_id'           => (string)$this->page_id,
199
-            'title'             => (string)$this->title,
200
-            'body'              => (string)$this->body,
201
-            'description'       => (string)$this->description,
202
-            'main_img'          => (string)$this->main_img,
203
-            'has_layout'        => (boolean)$this->has_layout,
204
-            'is_homepage'       => (boolean)$this->is_homepage,
205
-            'is_active'         => (boolean)$this->is_active,
206
-            'is_wysiwyg_editor' => (boolean)$this->is_wysiwyg_editor,
207
-            'created_at'        => (string)$this->created_at,
208
-            'slug'              => (string)$this->slug
197
+            'page_uuid'         => (binary) $this->page_uuid,
198
+            'page_id'           => (string) $this->page_id,
199
+            'title'             => (string) $this->title,
200
+            'body'              => (string) $this->body,
201
+            'description'       => (string) $this->description,
202
+            'main_img'          => (string) $this->main_img,
203
+            'has_layout'        => (boolean) $this->has_layout,
204
+            'is_homepage'       => (boolean) $this->is_homepage,
205
+            'is_active'         => (boolean) $this->is_active,
206
+            'is_wysiwyg_editor' => (boolean) $this->is_wysiwyg_editor,
207
+            'created_at'        => (string) $this->created_at,
208
+            'slug'              => (string) $this->slug
209 209
         ];
210 210
     }
211 211
 
Please login to merge, or discard this patch.
packages/Page/templates/partial/pagination.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
         </div>
8 8
     </div>
9 9
     <div class="col-sm-7">
10
-        <?php if($this->pageCount > 1): ?>
10
+        <?php if ($this->pageCount > 1): ?>
11 11
             <div class="pull-right">
12 12
                 <ul class="pagination" style="margin:0px;">
13 13
                     <!-- Previous page link -->
14
-                    <?php if(isset($this->previous)): ?>
14
+                    <?php if (isset($this->previous)): ?>
15 15
                         <li>
16
-                            <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : []); ?>?page=<?php echo $this->previous; ?>">
16
+                            <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : [ ]); ?>?page=<?php echo $this->previous; ?>">
17 17
                                 <span class="glyphicon glyphicon-chevron-left"></span>
18 18
                             </a>
19 19
                         </li>
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
                     <?php endif; ?>
27 27
 
28 28
                     <!-- Numbered page links -->
29
-                    <?php foreach($this->pagesInRange as $page): ?>
30
-                        <?php if($page != $this->current): ?>
29
+                    <?php foreach ($this->pagesInRange as $page): ?>
30
+                        <?php if ($page != $this->current): ?>
31 31
                             <li>
32
-                                <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : []); ?>?page=<?php echo $page; ?>">
32
+                                <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : [ ]); ?>?page=<?php echo $page; ?>">
33 33
                                     <?php echo $page; ?>
34 34
                                 </a>
35 35
                             </li>
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
                     <?php endforeach; ?>
42 42
 
43 43
                     <!-- Next page link -->
44
-                    <?php if(isset($this->next)): ?>
44
+                    <?php if (isset($this->next)): ?>
45 45
                         <li>
46
-                            <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : []); ?>?page=<?php echo $this->next; ?>">
46
+                            <a href="<?php echo $this->url($this->route, isset($this->data) ? $this->data : [ ]); ?>?page=<?php echo $this->next; ?>">
47 47
                                 <span class="glyphicon glyphicon-chevron-right"></span>
48 48
                             </a>
49 49
                         </li>
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,13 +17,16 @@  discard block
 block discarded – undo
17 17
                                 <span class="glyphicon glyphicon-chevron-left"></span>
18 18
                             </a>
19 19
                         </li>
20
-                    <?php else: ?>
20
+                    <?php else {
21
+    : ?>
21 22
                         <li class="disabled">
22 23
                             <a href="#">
23 24
                                 <span class="glyphicon glyphicon-chevron-left"></span>
24 25
                             </a>
25 26
                         </li>
26
-                    <?php endif; ?>
27
+                    <?php endif;
28
+}
29
+?>
27 30
 
28 31
                     <!-- Numbered page links -->
29 32
                     <?php foreach($this->pagesInRange as $page): ?>
@@ -33,9 +36,12 @@  discard block
 block discarded – undo
33 36
                                     <?php echo $page; ?>
34 37
                                 </a>
35 38
                             </li>
36
-                        <?php else: ?>
39
+                        <?php else {
40
+    : ?>
37 41
                             <li class="active">
38
-                                <a href="#"><?php echo $page; ?></a>
42
+                                <a href="#"><?php echo $page;
43
+}
44
+?></a>
39 45
                             </li>
40 46
                         <?php endif; ?>
41 47
                     <?php endforeach; ?>
@@ -47,13 +53,16 @@  discard block
 block discarded – undo
47 53
                                 <span class="glyphicon glyphicon-chevron-right"></span>
48 54
                             </a>
49 55
                         </li>
50
-                    <?php else: ?>
56
+                    <?php else {
57
+    : ?>
51 58
                         <li class="disabled">
52 59
                             <a href="#">
53 60
                                 <span class="glyphicon glyphicon-chevron-right"></span>
54 61
                             </a>
55 62
                         </li>
56
-                    <?php endif; ?>
63
+                    <?php endif;
64
+}
65
+?>
57 66
                 </ul>
58 67
             </div>
59 68
         <?php endif; ?>
Please login to merge, or discard this patch.
packages/Admin/src/Controller/UserController.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Admin\Controller;
6 6
 
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $user   = $this->session->getStorage()->user;
66 66
         $params = $this->request->getQueryParams();
67
-        $page   = isset($params['page']) ? $params['page'] : 1;
68
-        $limit  = isset($params['limit']) ? $params['limit'] : 15;
67
+        $page   = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
68
+        $limit  = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15;
69 69
 
70 70
         $adminUsers = $this->adminUserService->getPagination($page, $limit, $user->admin_user_id);
71 71
 
72
-        return new HtmlResponse($this->template->render('admin::user/index', ['list' => $adminUsers, 'layout' => 'layout/admin']));
72
+        return new HtmlResponse($this->template->render('admin::user/index', [ 'list' => $adminUsers, 'layout' => 'layout/admin' ]));
73 73
     }
74 74
 
75 75
     /**
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
      *
78 78
      * @return \Psr\Http\Message\ResponseInterface
79 79
      */
80
-    public function edit($errors = []): \Psr\Http\Message\ResponseInterface
80
+    public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface
81 81
     {
82 82
         $id   = $this->request->getAttribute('id');
83 83
         $user = $this->adminUserService->getUser($id);
84 84
 
85
-        if($this->request->getParsedBody()) {
86
-            $user                = (object)($this->request->getParsedBody() + (array)$user);
85
+        if ($this->request->getParsedBody()) {
86
+            $user                = (object) ($this->request->getParsedBody() + (array) $user);
87 87
             $user->admin_user_id = $id;
88 88
         }
89 89
 
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
         try {
100 100
             $userId = $this->request->getAttribute('id');
101 101
             $data   = $this->request->getParsedBody();
102
-            $data   += (new Request())->getFiles()->toArray();
102
+            $data += (new Request())->getFiles()->toArray();
103 103
 
104
-            if($userId) {
104
+            if ($userId) {
105 105
                 $this->adminUserService->updateUser($data, $userId);
106 106
             }
107 107
             else {
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 
111 111
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
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
     }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
128 128
         }
129
-        catch(\Exception $e) {
129
+        catch (\Exception $e) {
130 130
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
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($userId) {
105 105
                 $this->adminUserService->updateUser($data, $userId);
106
-            }
107
-            else {
106
+            } else {
108 107
                 $this->adminUserService->registerNewUser($data);
109 108
             }
110 109
 
111 110
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
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->adminUserService->delete($userId);
126 123
 
127 124
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
128
-        }
129
-        catch(\Exception $e) {
125
+        } catch(\Exception $e) {
130 126
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
131 127
         }
132 128
     }
Please login to merge, or discard this patch.