Completed
Push — master ( c02965...f19773 )
by Aleksandar
100:21 queued 75:50
created
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/Web/Action/HomeAction.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@
 block discarded – undo
20 20
     /**
21 21
 * 
22 22
      *
23
- * @var Template 
23
+     * @var Template 
24 24
 */
25 25
     private $template;
26 26
 
27 27
     /**
28 28
 * 
29 29
      *
30
- * @var PageService 
30
+     * @var PageService 
31 31
 */
32 32
     private $pageService;
33 33
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 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 Web\Action;
6 6
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
         $page = $this->pageService->getHomepage();
60 60
 
61
-        return new HtmlResponse($this->template->render('web::home', ['page' => $page, 'layout' => 'layout/web']));
61
+        return new HtmlResponse($this->template->render('web::home', [ 'page' => $page, 'layout' => 'layout/web' ]));
62 62
     }
63 63
 
64 64
 }
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.
packages/Admin/src/Mapper/AdminUsersMapper.php 2 patches
Doc Comments   +12 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,6 +31,9 @@  discard block
 block discarded – undo
31 31
         $this->adapter = $adapter;
32 32
     }
33 33
 
34
+    /**
35
+     * @param string $id
36
+     */
34 37
     public function get($id)
35 38
     {
36 39
         return $this->select(['admin_user_id' => $id])->current();
@@ -40,7 +43,7 @@  discard block
 block discarded – undo
40 43
      * Get admin user by email.
41 44
      *
42 45
      * @param  string $email email
43
-     * @return array|\ArrayObject|null
46
+     * @return string
44 47
      */
45 48
     public function getByEmail(string $email)
46 49
     {
@@ -50,7 +53,6 @@  discard block
 block discarded – undo
50 53
     /**
51 54
      * Updates login data.
52 55
      *
53
-     * @param  string $uuid admin user id
54 56
      * @return int number of affected rows
55 57
      */
56 58
     public function updateLogin(string $userId): int
@@ -58,6 +60,11 @@  discard block
 block discarded – undo
58 60
         return $this->update(['last_login' => date('Y-m-d H:i:s')], ['admin_user_id' => $userId]);
59 61
     }
60 62
 
63
+    /**
64
+     * @param string $userId
65
+     *
66
+     * @return \Zend\Db\Sql\Select
67
+     */
61 68
     public function getPaginationSelect($userId)
62 69
     {
63 70
         $select = $this->getSql()->select()->order(['created_at' => 'desc']);
@@ -67,6 +74,9 @@  discard block
 block discarded – undo
67 74
         return $select;
68 75
     }
69 76
 
77
+    /**
78
+     * @param integer $limit
79
+     */
70 80
     public function getRandom($limit)
71 81
     {
72 82
         $select = $this->getSql()->select()
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Admin\Mapper;
5 5
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function get($id)
35 35
     {
36
-        return $this->select(['admin_user_id' => $id])->current();
36
+        return $this->select([ 'admin_user_id' => $id ])->current();
37 37
     }
38 38
 
39 39
     /**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function getByEmail(string $email)
46 46
     {
47
-        return $this->select(['email' => $email])->current();
47
+        return $this->select([ 'email' => $email ])->current();
48 48
     }
49 49
 
50 50
     /**
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function updateLogin(string $userId): int
57 57
     {
58
-        return $this->update(['last_login' => date('Y-m-d H:i:s')], ['admin_user_id' => $userId]);
58
+        return $this->update([ 'last_login' => date('Y-m-d H:i:s') ], [ 'admin_user_id' => $userId ]);
59 59
     }
60 60
 
61 61
     public function getPaginationSelect($userId)
62 62
     {
63
-        $select = $this->getSql()->select()->order(['created_at' => 'desc']);
63
+        $select = $this->getSql()->select()->order([ 'created_at' => 'desc' ]);
64 64
 
65 65
         $select->where->notEqualTo('admin_user_id', $userId);
66 66
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     public function getRandom($limit)
71 71
     {
72 72
         $select = $this->getSql()->select()
73
-            ->where(['status' => 1])
73
+            ->where([ 'status' => 1 ])
74 74
             ->order(new Expression('rand()'))
75 75
             ->limit($limit);
76 76
 
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 
80 80
     public function getUuid($adminUserId)
81 81
     {
82
-        $user = $this->select(['admin_user_id' => $adminUserId])->current();
82
+        $user = $this->select([ 'admin_user_id' => $adminUserId ])->current();
83 83
 
84
-        if(!$user) {
84
+        if (!$user) {
85 85
             throw new \Exception('Admin user does not exist!', 400);
86 86
         }
87 87
 
Please login to merge, or discard this patch.
packages/Admin/src/Middleware/AdminAuth.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
packages/Admin/src/Service/AdminUserService.php 2 patches
Spacing   +24 added lines, -24 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\Service;
6 6
 
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function loginUser($email, $password)
83 83
     {
84
-        if(!$email || !$password) {
84
+        if (!$email || !$password) {
85 85
             throw new \Exception('Both email and password are required.', 400);
86 86
         }
87 87
 
88 88
         $user = $this->adminUsersMapper->getByEmail($email);
89 89
 
90
-        if(!$user) {
90
+        if (!$user) {
91 91
             throw new \Exception('User does not exist.');
92 92
         }
93 93
 
94
-        if(!$this->crypt->verify($password, $user->password)) {
94
+        if (!$this->crypt->verify($password, $user->password)) {
95 95
             throw new \Exception('Password does not match.');
96 96
         }
97 97
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     {
136 136
         $filter = $this->adminUserFilter->getInputFilter()->setData($data);
137 137
 
138
-        if(!$filter->isValid()) {
138
+        if (!$filter->isValid()) {
139 139
             throw new FilterException($filter->getMessages());
140 140
         }
141 141
 
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
                 'profile_img' => $this->upload->uploadImage($data, 'profile_img')
145 145
             ];
146 146
 
147
-        unset($data['confirm_password']);
148
-        $data['password']        = $this->crypt->create($data['password']);
149
-        $data['admin_user_id']   = Uuid::uuid1()->toString();
150
-        $data['admin_user_uuid'] = (new MysqlUuid($data['admin_user_id']))->toFormat(new Binary);
147
+        unset($data[ 'confirm_password' ]);
148
+        $data[ 'password' ]        = $this->crypt->create($data[ 'password' ]);
149
+        $data[ 'admin_user_id' ]   = Uuid::uuid1()->toString();
150
+        $data[ 'admin_user_uuid' ] = (new MysqlUuid($data[ 'admin_user_id' ]))->toFormat(new Binary);
151 151
 
152 152
         return $this->adminUsersMapper->insert($data);
153 153
     }
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
         $filter = $this->adminUserFilter->getInputFilter()->setData($data);
162 162
 
163 163
         // we dont want to force user to enter the password again
164
-        if($data['password'] == '') {
164
+        if ($data[ 'password' ] == '') {
165 165
             $filter->remove('password');
166 166
             $filter->remove('confirm_password');
167 167
         }
168 168
 
169 169
         // if we want to keep same email
170
-        if($user->email == $data['email']) {
170
+        if ($user->email == $data[ 'email' ]) {
171 171
             $filter->remove('email');
172 172
         }
173 173
 
174
-        if(!$filter->isValid()) {
174
+        if (!$filter->isValid()) {
175 175
             throw new FilterException($filter->getMessages());
176 176
         }
177 177
 
@@ -181,26 +181,26 @@  discard block
 block discarded – undo
181 181
             ];
182 182
 
183 183
         // We don't want to force user to re-upload image on edit
184
-        if(!$data['face_img']) {
185
-            unset($data['face_img']);
184
+        if (!$data[ 'face_img' ]) {
185
+            unset($data[ 'face_img' ]);
186 186
         }
187
-        else{
187
+        else {
188 188
             $this->upload->deleteFile($user->face_img);
189 189
         }
190 190
 
191
-        if(!$data['profile_img']) {
192
-            unset($data['profile_img']);
191
+        if (!$data[ 'profile_img' ]) {
192
+            unset($data[ 'profile_img' ]);
193 193
         }
194
-        else{
194
+        else {
195 195
             $this->upload->deleteFile($user->profile_img);
196 196
         }
197 197
 
198
-        if(isset($data['password'])) {
199
-            unset($data['confirm_password']);
200
-            $data['password'] = $this->crypt->create($data['password']);
198
+        if (isset($data[ 'password' ])) {
199
+            unset($data[ 'confirm_password' ]);
200
+            $data[ 'password' ] = $this->crypt->create($data[ 'password' ]);
201 201
         }
202 202
 
203
-        return $this->adminUsersMapper->update($data, ['admin_user_id' => $userId]);
203
+        return $this->adminUsersMapper->update($data, [ 'admin_user_id' => $userId ]);
204 204
     }
205 205
 
206 206
     /**
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public function delete($userId)
214 214
     {
215
-        if(!($adminUser = $this->getUser($userId))) {
215
+        if (!($adminUser = $this->getUser($userId))) {
216 216
             throw new \Exception('Admin user not found.');
217 217
         }
218 218
 
219 219
         $this->upload->deleteFile($adminUser->face_img);
220 220
         $this->upload->deleteFile($adminUser->profile_img);
221 221
 
222
-        return (bool)$this->adminUsersMapper->delete(['admin_user_id' => $userId]);
222
+        return (bool) $this->adminUsersMapper->delete([ 'admin_user_id' => $userId ]);
223 223
     }
224 224
 
225 225
     /**
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -167,15 +167,13 @@
 block discarded – undo
167 167
         // We don't want to force user to re-upload image on edit
168 168
         if(!$data['face_img']) {
169 169
             unset($data['face_img']);
170
-        }
171
-        else{
170
+        } else{
172 171
             $this->upload->deleteFile($user->face_img);
173 172
         }
174 173
 
175 174
         if(!$data['profile_img']) {
176 175
             unset($data['profile_img']);
177
-        }
178
-        else{
176
+        } else{
179 177
             $this->upload->deleteFile($user->profile_img);
180 178
         }
181 179
 
Please login to merge, or discard this patch.