Passed
Pull Request — master (#6)
by nguereza
02:23
created
app/Http/Action/User/UserAction.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -33,80 +33,80 @@  discard block
 block discarded – undo
33 33
 class UserAction
34 34
 {
35 35
     /**
36
-    * The Lang instance
37
-    * @var Lang
38
-    */
36
+     * The Lang instance
37
+     * @var Lang
38
+     */
39 39
     protected Lang $lang;
40 40
 
41 41
     /**
42
-    * The Pagination instance
43
-    * @var Pagination
44
-    */
42
+     * The Pagination instance
43
+     * @var Pagination
44
+     */
45 45
     protected Pagination $pagination;
46 46
 
47 47
     /**
48
-    * The Template instance
49
-    * @var Template
50
-    */
48
+     * The Template instance
49
+     * @var Template
50
+     */
51 51
     protected Template $template;
52 52
 
53 53
     /**
54
-    * The Flash instance
55
-    * @var Flash
56
-    */
54
+     * The Flash instance
55
+     * @var Flash
56
+     */
57 57
     protected Flash $flash;
58 58
 
59 59
     /**
60
-    * The RouteHelper instance
61
-    * @var RouteHelper
62
-    */
60
+     * The RouteHelper instance
61
+     * @var RouteHelper
62
+     */
63 63
     protected RouteHelper $routeHelper;
64 64
 
65 65
     /**
66
-    * The LoggerInterface instance
67
-    * @var LoggerInterface
68
-    */
66
+     * The LoggerInterface instance
67
+     * @var LoggerInterface
68
+     */
69 69
     protected LoggerInterface $logger;
70 70
 
71 71
     /**
72
-    * The RoleRepository instance
73
-    * @var RoleRepository
74
-    */
72
+     * The RoleRepository instance
73
+     * @var RoleRepository
74
+     */
75 75
     protected RoleRepository $roleRepository;
76 76
 
77 77
     /**
78
-    * The StatusList instance
79
-    * @var StatusList
80
-    */
78
+     * The StatusList instance
79
+     * @var StatusList
80
+     */
81 81
     protected StatusList $statusList;
82 82
 
83 83
     /**
84
-    * The HashInterface instance
85
-    * @var HashInterface
86
-    */
84
+     * The HashInterface instance
85
+     * @var HashInterface
86
+     */
87 87
     protected HashInterface $hash;
88 88
 
89 89
     /**
90
-    * The UserRepository instance
91
-    * @var UserRepository
92
-    */
90
+     * The UserRepository instance
91
+     * @var UserRepository
92
+     */
93 93
     protected UserRepository $userRepository;
94 94
 
95 95
 
96 96
 
97 97
     /**
98
-    * Create new instance
99
-    * @param Lang $lang
100
-    * @param Pagination $pagination
101
-    * @param Template $template
102
-    * @param Flash $flash
103
-    * @param RouteHelper $routeHelper
104
-    * @param LoggerInterface $logger
105
-    * @param RoleRepository $roleRepository
106
-    * @param StatusList $statusList
107
-    * @param HashInterface $hash
108
-    * @param UserRepository $userRepository
109
-    */
98
+     * Create new instance
99
+     * @param Lang $lang
100
+     * @param Pagination $pagination
101
+     * @param Template $template
102
+     * @param Flash $flash
103
+     * @param RouteHelper $routeHelper
104
+     * @param LoggerInterface $logger
105
+     * @param RoleRepository $roleRepository
106
+     * @param StatusList $statusList
107
+     * @param HashInterface $hash
108
+     * @param UserRepository $userRepository
109
+     */
110 110
     public function __construct(
111 111
         Lang $lang,
112 112
         Pagination $pagination,
@@ -132,16 +132,16 @@  discard block
 block discarded – undo
132 132
     }
133 133
 
134 134
     /**
135
-    * List all entities
136
-    * @param ServerRequestInterface $request
137
-    * @return ResponseInterface
138
-    */
135
+     * List all entities
136
+     * @param ServerRequestInterface $request
137
+     * @return ResponseInterface
138
+     */
139 139
     public function index(ServerRequestInterface $request): ResponseInterface
140 140
     {
141 141
         $context = [];
142 142
         $param = new RequestData($request);
143 143
         $totalItems = $this->userRepository->query()
144
-                                               ->count('id');
144
+                                                ->count('id');
145 145
 
146 146
         $currentPage = (int) $param->get('page', 1);
147 147
 
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
     }
172 172
 
173 173
     /**
174
-    * List entity detail
175
-    * @param ServerRequestInterface $request
176
-    * @return ResponseInterface
177
-    */
174
+     * List entity detail
175
+     * @param ServerRequestInterface $request
176
+     * @return ResponseInterface
177
+     */
178 178
     public function detail(ServerRequestInterface $request): ResponseInterface
179 179
     {
180 180
         $context = [];
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
     }
202 202
 
203 203
     /**
204
-    * Create new entity
205
-    * @param ServerRequestInterface $request
206
-    * @return ResponseInterface
207
-    */
204
+     * Create new entity
205
+     * @param ServerRequestInterface $request
206
+     * @return ResponseInterface
207
+     */
208 208
     public function create(ServerRequestInterface $request): ResponseInterface
209 209
     {
210 210
         $context = [];
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         $formParam = new UserParam($param->posts());
214 214
         $context['param'] = $formParam;
215 215
         $context['roles'] = $this->roleRepository->orderBy('name')
216
-                                                 ->all();
216
+                                                    ->all();
217 217
 
218 218
         $context['user_status'] = $this->statusList->getUserStatus();
219 219
 
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
         }
239 239
 
240 240
         $usernameExist = $this->userRepository->findBy([
241
-                                               'username' => $formParam->getUsername(),
242
-                                           ]);
241
+                                                'username' => $formParam->getUsername(),
242
+                                            ]);
243 243
 
244 244
         if ($usernameExist !== null) {
245 245
             $this->flash->setError($this->lang->tr('This username already exist'));
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
         }
253 253
 
254 254
         $emailExist = $this->userRepository->findBy([
255
-                                               'email' => $formParam->getEmail(),
256
-                                           ]);
255
+                                                'email' => $formParam->getEmail(),
256
+                                            ]);
257 257
 
258 258
         if ($emailExist !== null) {
259 259
             $this->flash->setError($this->lang->tr('This email already exist'));
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
         /** @var User $user */
271 271
         $user = $this->userRepository->create([
272
-           'username' => $formParam->getUsername(),
272
+            'username' => $formParam->getUsername(),
273 273
         'lastname' => Str::upper($formParam->getLastname()),
274 274
         'firstname' => Str::ucfirst($formParam->getFirstname()),
275 275
         'email' => $formParam->getEmail(),
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
     }
307 307
 
308 308
     /**
309
-    * Update existing entity
310
-    * @param ServerRequestInterface $request
311
-    * @return ResponseInterface
312
-    */
309
+     * Update existing entity
310
+     * @param ServerRequestInterface $request
311
+     * @return ResponseInterface
312
+     */
313 313
     public function update(ServerRequestInterface $request): ResponseInterface
314 314
     {
315 315
         $context = [];
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
         $context['param']->setRoles($currentRolesId);
334 334
 
335 335
         $context['roles'] = $this->roleRepository->orderBy('name')
336
-                                                 ->all();
336
+                                                    ->all();
337 337
 
338 338
         $context['user_status'] = $this->statusList->getUserStatus();
339 339
 
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
         }
360 360
 
361 361
         $usernameExist = $this->userRepository->findBy([
362
-                                               'username' => $formParam->getUsername(),
363
-                                           ]);
362
+                                                'username' => $formParam->getUsername(),
363
+                                            ]);
364 364
 
365 365
         if ($usernameExist !== null && $usernameExist->id !== $id) {
366 366
             $this->flash->setError($this->lang->tr('This username already exist'));
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
         }
374 374
 
375 375
         $emailExist = $this->userRepository->findBy([
376
-                                               'email' => $formParam->getEmail(),
377
-                                           ]);
376
+                                                'email' => $formParam->getEmail(),
377
+                                            ]);
378 378
 
379 379
         if ($emailExist !== null && $emailExist->id !== $id) {
380 380
             $this->flash->setError($this->lang->tr('This email already exist'));
@@ -435,10 +435,10 @@  discard block
 block discarded – undo
435 435
     }
436 436
 
437 437
     /**
438
-    * Delete the entity
439
-    * @param ServerRequestInterface $request
440
-    * @return ResponseInterface
441
-    */
438
+     * Delete the entity
439
+     * @param ServerRequestInterface $request
440
+     * @return ResponseInterface
441
+     */
442 442
     public function delete(ServerRequestInterface $request): ResponseInterface
443 443
     {
444 444
         $id = (int) $request->getAttribute('id');
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@
 block discarded – undo
30 30
 * @class UserAction
31 31
 * @package Platine\App\Http\Action\User
32 32
 */
33
-class UserAction
34
-{
33
+class UserAction {
35 34
     /**
36 35
     * The Lang instance
37 36
     * @var Lang
Please login to merge, or discard this patch.
app/Validator/UserValidator.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 class UserValidator extends AbstractValidator
25 25
 {
26 26
     /**
27
-    * The parameter instance
28
-    * @var UserParam<TEntity>
29
-    */
27
+     * The parameter instance
28
+     * @var UserParam<TEntity>
29
+     */
30 30
     protected UserParam $param;
31 31
 
32 32
     /**
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
     protected bool $ignorePassword;
37 37
 
38 38
     /**
39
-    * Create new instance
40
-    * @param UserParam<TEntity> $param
41
-    * @param Lang $lang
42
-    * @param bool $ignorePassword
43
-    */
39
+     * Create new instance
40
+     * @param UserParam<TEntity> $param
41
+     * @param Lang $lang
42
+     * @param bool $ignorePassword
43
+     */
44 44
     public function __construct(UserParam $param, Lang $lang, bool $ignorePassword = false)
45 45
     {
46 46
         parent::__construct($lang);
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
     }
50 50
 
51 51
     /**
52
-    * {@inheritdoc}
53
-    */
52
+     * {@inheritdoc}
53
+     */
54 54
     public function setValidationData(): void
55 55
     {
56 56
         $this->addData('username', $this->param->getUsername());
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
     }
65 65
 
66 66
     /**
67
-    * {@inheritdoc}
68
-    */
67
+     * {@inheritdoc}
68
+     */
69 69
     public function setValidationRules(): void
70 70
     {
71 71
         $this->addRules('username', [
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
 * @package Platine\App\Validator
22 22
 * @template TEntity as \Platine\Orm\Entity
23 23
 */
24
-class UserValidator extends AbstractValidator
25
-{
24
+class UserValidator extends AbstractValidator {
26 25
     /**
27 26
     * The parameter instance
28 27
     * @var UserParam<TEntity>
@@ -41,8 +40,7 @@  discard block
 block discarded – undo
41 40
     * @param Lang $lang
42 41
     * @param bool $ignorePassword
43 42
     */
44
-    public function __construct(UserParam $param, Lang $lang, bool $ignorePassword = false)
45
-    {
43
+    public function __construct(UserParam $param, Lang $lang, bool $ignorePassword = false) {
46 44
         parent::__construct($lang);
47 45
         $this->param = $param;
48 46
         $this->ignorePassword = $ignorePassword;
Please login to merge, or discard this patch.