Completed
Pull Request — master (#106)
by
unknown
22:56 queued 05:30
created
packages/Category/src/Factory/Service/CategoryServiceFactory.php 1 patch
Spacing   +3 added lines, -3 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 Category\Factory\Service;
5 5
 
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function __invoke(ContainerInterface $container): CategoryService
22 22
     {
23
-        $config = $container->get('config')['upload'];
24
-        $upload = new Upload($config['public_path'], $config['non_public_path']);
23
+        $config = $container->get('config')[ 'upload' ];
24
+        $upload = new Upload($config[ 'public_path' ], $config[ 'non_public_path' ]);
25 25
 
26 26
         return new CategoryService(
27 27
             $container->get(CategoryMapper::class),
Please login to merge, or discard this patch.
packages/Core/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 Core\Service;
6 6
 
@@ -65,17 +65,17 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function loginUser($email, $password)
67 67
     {
68
-        if(!$email || !$password) {
68
+        if (!$email || !$password) {
69 69
             throw new \Exception('Both email and password are required.', 400);
70 70
         }
71 71
 
72 72
         $user = $this->adminUsersMapper->getByEmail($email);
73 73
 
74
-        if(!$user) {
74
+        if (!$user) {
75 75
             throw new \Exception('User does not exist.');
76 76
         }
77 77
 
78
-        if(!$this->crypt->verify($password, $user->password)) {
78
+        if (!$this->crypt->verify($password, $user->password)) {
79 79
             throw new \Exception('Password does not match.');
80 80
         }
81 81
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     {
120 120
         $filter = $this->adminUserFilter->getInputFilter()->setData($data);
121 121
 
122
-        if(!$filter->isValid()) {
122
+        if (!$filter->isValid()) {
123 123
             throw new FilterException($filter->getMessages());
124 124
         }
125 125
 
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
                 'profile_img' => $this->upload->uploadImage($data, 'profile_img')
129 129
             ];
130 130
 
131
-        unset($data['confirm_password']);
132
-        $data['password']        = $this->crypt->create($data['password']);
133
-        $data['admin_user_id']   = Uuid::uuid1()->toString();
134
-        $data['admin_user_uuid'] = (new MysqlUuid($data['admin_user_id']))->toFormat(new Binary);
131
+        unset($data[ 'confirm_password' ]);
132
+        $data[ 'password' ]        = $this->crypt->create($data[ 'password' ]);
133
+        $data[ 'admin_user_id' ]   = Uuid::uuid1()->toString();
134
+        $data[ 'admin_user_uuid' ] = (new MysqlUuid($data[ 'admin_user_id' ]))->toFormat(new Binary);
135 135
 
136 136
         return $this->adminUsersMapper->insert($data);
137 137
     }
@@ -145,17 +145,17 @@  discard block
 block discarded – undo
145 145
         $filter = $this->adminUserFilter->getInputFilter()->setData($data);
146 146
 
147 147
         // we dont want to force user to enter the password again
148
-        if($data['password'] == '') {
148
+        if ($data[ 'password' ] == '') {
149 149
             $filter->remove('password');
150 150
             $filter->remove('confirm_password');
151 151
         }
152 152
 
153 153
         // if we want to keep same email
154
-        if($user->email == $data['email']) {
154
+        if ($user->email == $data[ 'email' ]) {
155 155
             $filter->remove('email');
156 156
         }
157 157
 
158
-        if(!$filter->isValid()) {
158
+        if (!$filter->isValid()) {
159 159
             throw new FilterException($filter->getMessages());
160 160
         }
161 161
 
@@ -165,26 +165,26 @@  discard block
 block discarded – undo
165 165
             ];
166 166
 
167 167
         // We don't want to force user to re-upload image on edit
168
-        if(!$data['face_img']) {
169
-            unset($data['face_img']);
168
+        if (!$data[ 'face_img' ]) {
169
+            unset($data[ 'face_img' ]);
170 170
         }
171
-        else{
171
+        else {
172 172
             $this->upload->deleteFile($user->face_img);
173 173
         }
174 174
 
175
-        if(!$data['profile_img']) {
176
-            unset($data['profile_img']);
175
+        if (!$data[ 'profile_img' ]) {
176
+            unset($data[ 'profile_img' ]);
177 177
         }
178
-        else{
178
+        else {
179 179
             $this->upload->deleteFile($user->profile_img);
180 180
         }
181 181
 
182
-        if(isset($data['password'])) {
183
-            unset($data['confirm_password']);
184
-            $data['password'] = $this->crypt->create($data['password']);
182
+        if (isset($data[ 'password' ])) {
183
+            unset($data[ 'confirm_password' ]);
184
+            $data[ 'password' ] = $this->crypt->create($data[ 'password' ]);
185 185
         }
186 186
 
187
-        return $this->adminUsersMapper->update($data, ['admin_user_id' => $userId]);
187
+        return $this->adminUsersMapper->update($data, [ 'admin_user_id' => $userId ]);
188 188
     }
189 189
 
190 190
     /**
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
      */
197 197
     public function delete($userId)
198 198
     {
199
-        if(!($adminUser = $this->getUser($userId))){
199
+        if (!($adminUser = $this->getUser($userId))) {
200 200
             throw new \Exception('Admin user not found.');
201 201
         }
202 202
 
203 203
         $this->upload->deleteFile($adminUser->face_img);
204 204
         $this->upload->deleteFile($adminUser->profile_img);
205 205
 
206
-        return (bool)$this->adminUsersMapper->delete(['admin_user_id' => $userId]);
206
+        return (bool) $this->adminUsersMapper->delete([ 'admin_user_id' => $userId ]);
207 207
     }
208 208
 
209 209
     /**
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.