@@ -54,14 +54,12 @@ |
||
54 | 54 | * @class ServerCommand |
55 | 55 | * @package Platine\App\Console\Command |
56 | 56 | */ |
57 | -class ServerCommand extends Command |
|
58 | -{ |
|
57 | +class ServerCommand extends Command { |
|
59 | 58 | /** |
60 | 59 | * Create new instance |
61 | 60 | * {@inheritdoc} |
62 | 61 | */ |
63 | - public function __construct(protected Shell $shell) |
|
64 | - { |
|
62 | + public function __construct(protected Shell $shell) { |
|
65 | 63 | parent::__construct('server', 'Command to manage PHP development server'); |
66 | 64 | $this->addOption('-a|--address', 'Server address', 'localhost', true); |
67 | 65 | $this->addOption('-p|--port', 'Server listen port', '8080', true); |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | class PermissionAction |
29 | 29 | { |
30 | 30 | /** |
31 | - * Create new instance |
|
32 | - * @param Lang $lang |
|
33 | - * @param Pagination $pagination |
|
34 | - * @param Template $template |
|
35 | - * @param Flash $flash |
|
36 | - * @param RouteHelper $routeHelper |
|
37 | - * @param LoggerInterface $logger |
|
38 | - * @param PermissionRepository $permissionRepository |
|
39 | - */ |
|
31 | + * Create new instance |
|
32 | + * @param Lang $lang |
|
33 | + * @param Pagination $pagination |
|
34 | + * @param Template $template |
|
35 | + * @param Flash $flash |
|
36 | + * @param RouteHelper $routeHelper |
|
37 | + * @param LoggerInterface $logger |
|
38 | + * @param PermissionRepository $permissionRepository |
|
39 | + */ |
|
40 | 40 | public function __construct( |
41 | 41 | protected Lang $lang, |
42 | 42 | protected Pagination $pagination, |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | - * List all entities |
|
53 | - * @param ServerRequestInterface $request |
|
54 | - * @return ResponseInterface |
|
55 | - */ |
|
52 | + * List all entities |
|
53 | + * @param ServerRequestInterface $request |
|
54 | + * @return ResponseInterface |
|
55 | + */ |
|
56 | 56 | public function index(ServerRequestInterface $request): ResponseInterface |
57 | 57 | { |
58 | 58 | $context = []; |
59 | 59 | $param = new RequestData($request); |
60 | 60 | $totalItems = $this->permissionRepository->query() |
61 | - ->count('id'); |
|
61 | + ->count('id'); |
|
62 | 62 | |
63 | 63 | $currentPage = (int) $param->get('page', 1); |
64 | 64 | |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | - * List entity detail |
|
90 | - * @param ServerRequestInterface $request |
|
91 | - * @return ResponseInterface |
|
92 | - */ |
|
89 | + * List entity detail |
|
90 | + * @param ServerRequestInterface $request |
|
91 | + * @return ResponseInterface |
|
92 | + */ |
|
93 | 93 | public function detail(ServerRequestInterface $request): ResponseInterface |
94 | 94 | { |
95 | 95 | $context = []; |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Create new entity |
|
119 | - * @param ServerRequestInterface $request |
|
120 | - * @return ResponseInterface |
|
121 | - */ |
|
118 | + * Create new entity |
|
119 | + * @param ServerRequestInterface $request |
|
120 | + * @return ResponseInterface |
|
121 | + */ |
|
122 | 122 | public function create(ServerRequestInterface $request): ResponseInterface |
123 | 123 | { |
124 | 124 | $context = []; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $context['param'] = $formParam; |
129 | 129 | |
130 | 130 | $permissions = $this->permissionRepository->orderBy('code') |
131 | - ->all(); |
|
131 | + ->all(); |
|
132 | 132 | |
133 | 133 | $context['permissions'] = $permissions; |
134 | 134 | |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | $entityExist = $this->permissionRepository->findBy([ |
155 | - 'code' => $formParam->getCode(), |
|
156 | - ]); |
|
155 | + 'code' => $formParam->getCode(), |
|
156 | + ]); |
|
157 | 157 | |
158 | 158 | if ($entityExist !== null) { |
159 | 159 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | |
168 | 168 | /** @var Permission $permission */ |
169 | 169 | $permission = $this->permissionRepository->create([ |
170 | - 'code' => $formParam->getCode(), |
|
171 | - 'description' => $formParam->getDescription(), |
|
170 | + 'code' => $formParam->getCode(), |
|
171 | + 'description' => $formParam->getDescription(), |
|
172 | 172 | ]); |
173 | 173 | |
174 | 174 | try { |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
196 | - * Update existing entity |
|
197 | - * @param ServerRequestInterface $request |
|
198 | - * @return ResponseInterface |
|
199 | - */ |
|
196 | + * Update existing entity |
|
197 | + * @param ServerRequestInterface $request |
|
198 | + * @return ResponseInterface |
|
199 | + */ |
|
200 | 200 | public function update(ServerRequestInterface $request): ResponseInterface |
201 | 201 | { |
202 | 202 | $context = []; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $context['param'] = (new PermissionParam())->fromEntity($permission); |
219 | 219 | |
220 | 220 | $permissions = $this->permissionRepository->orderBy('code') |
221 | - ->all(); |
|
221 | + ->all(); |
|
222 | 222 | |
223 | 223 | $context['permissions'] = $permissions; |
224 | 224 | |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | } |
245 | 245 | |
246 | 246 | $entityExist = $this->permissionRepository->findBy([ |
247 | - 'code' => $formParam->getCode(), |
|
248 | - ]); |
|
247 | + 'code' => $formParam->getCode(), |
|
248 | + ]); |
|
249 | 249 | |
250 | 250 | if ($entityExist !== null && $entityExist->id !== $id) { |
251 | 251 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -282,10 +282,10 @@ discard block |
||
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
285 | - * Delete the entity |
|
286 | - * @param ServerRequestInterface $request |
|
287 | - * @return ResponseInterface |
|
288 | - */ |
|
285 | + * Delete the entity |
|
286 | + * @param ServerRequestInterface $request |
|
287 | + * @return ResponseInterface |
|
288 | + */ |
|
289 | 289 | public function delete(ServerRequestInterface $request): ResponseInterface |
290 | 290 | { |
291 | 291 | $id = (int) $request->getAttribute('id'); |
@@ -25,8 +25,7 @@ |
||
25 | 25 | * @class PermissionAction |
26 | 26 | * @package Platine\App\Http\Action\Permission |
27 | 27 | */ |
28 | -class PermissionAction |
|
29 | -{ |
|
28 | +class PermissionAction { |
|
30 | 29 | /** |
31 | 30 | * Create new instance |
32 | 31 | * @param Lang $lang |
@@ -33,18 +33,18 @@ discard block |
||
33 | 33 | class UserAction |
34 | 34 | { |
35 | 35 | /** |
36 | - * Create new instance |
|
37 | - * @param Lang $lang |
|
38 | - * @param Pagination $pagination |
|
39 | - * @param Template $template |
|
40 | - * @param Flash $flash |
|
41 | - * @param RouteHelper $routeHelper |
|
42 | - * @param LoggerInterface $logger |
|
43 | - * @param RoleRepository $roleRepository |
|
44 | - * @param StatusList $statusList |
|
45 | - * @param HashInterface $hash |
|
46 | - * @param UserRepository $userRepository |
|
47 | - */ |
|
36 | + * Create new instance |
|
37 | + * @param Lang $lang |
|
38 | + * @param Pagination $pagination |
|
39 | + * @param Template $template |
|
40 | + * @param Flash $flash |
|
41 | + * @param RouteHelper $routeHelper |
|
42 | + * @param LoggerInterface $logger |
|
43 | + * @param RoleRepository $roleRepository |
|
44 | + * @param StatusList $statusList |
|
45 | + * @param HashInterface $hash |
|
46 | + * @param UserRepository $userRepository |
|
47 | + */ |
|
48 | 48 | public function __construct( |
49 | 49 | protected Lang $lang, |
50 | 50 | protected Pagination $pagination, |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | - * List all entities |
|
64 | - * @param ServerRequestInterface $request |
|
65 | - * @return ResponseInterface |
|
66 | - */ |
|
63 | + * List all entities |
|
64 | + * @param ServerRequestInterface $request |
|
65 | + * @return ResponseInterface |
|
66 | + */ |
|
67 | 67 | public function index(ServerRequestInterface $request): ResponseInterface |
68 | 68 | { |
69 | 69 | $context = []; |
70 | 70 | $param = new RequestData($request); |
71 | 71 | $totalItems = $this->userRepository->query() |
72 | - ->count('id'); |
|
72 | + ->count('id'); |
|
73 | 73 | |
74 | 74 | $currentPage = (int) $param->get('page', 1); |
75 | 75 | |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | - * List entity detail |
|
103 | - * @param ServerRequestInterface $request |
|
104 | - * @return ResponseInterface |
|
105 | - */ |
|
102 | + * List entity detail |
|
103 | + * @param ServerRequestInterface $request |
|
104 | + * @return ResponseInterface |
|
105 | + */ |
|
106 | 106 | public function detail(ServerRequestInterface $request): ResponseInterface |
107 | 107 | { |
108 | 108 | $context = []; |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
132 | - * Create new entity |
|
133 | - * @param ServerRequestInterface $request |
|
134 | - * @return ResponseInterface |
|
135 | - */ |
|
132 | + * Create new entity |
|
133 | + * @param ServerRequestInterface $request |
|
134 | + * @return ResponseInterface |
|
135 | + */ |
|
136 | 136 | public function create(ServerRequestInterface $request): ResponseInterface |
137 | 137 | { |
138 | 138 | $context = []; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $formParam = new UserParam($param->posts()); |
142 | 142 | $context['param'] = $formParam; |
143 | 143 | $context['roles'] = $this->roleRepository->orderBy('name') |
144 | - ->all(); |
|
144 | + ->all(); |
|
145 | 145 | |
146 | 146 | $context['user_status'] = $this->statusList->getUserStatus(); |
147 | 147 | |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | $usernameExist = $this->userRepository->findBy([ |
169 | - 'username' => $formParam->getUsername(), |
|
170 | - ]); |
|
169 | + 'username' => $formParam->getUsername(), |
|
170 | + ]); |
|
171 | 171 | |
172 | 172 | if ($usernameExist !== null) { |
173 | 173 | $this->flash->setError($this->lang->tr('This username already exist')); |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | $emailExist = $this->userRepository->findBy([ |
183 | - 'email' => $formParam->getEmail(), |
|
184 | - ]); |
|
183 | + 'email' => $formParam->getEmail(), |
|
184 | + ]); |
|
185 | 185 | |
186 | 186 | if ($emailExist !== null) { |
187 | 187 | $this->flash->setError($this->lang->tr('This email already exist')); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | /** @var User $user */ |
199 | 199 | $user = $this->userRepository->create([ |
200 | - 'username' => $formParam->getUsername(), |
|
200 | + 'username' => $formParam->getUsername(), |
|
201 | 201 | 'lastname' => Str::upper($formParam->getLastname()), |
202 | 202 | 'firstname' => Str::ucfirst($formParam->getFirstname()), |
203 | 203 | 'email' => $formParam->getEmail(), |
@@ -234,10 +234,10 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
237 | - * Update existing entity |
|
238 | - * @param ServerRequestInterface $request |
|
239 | - * @return ResponseInterface |
|
240 | - */ |
|
237 | + * Update existing entity |
|
238 | + * @param ServerRequestInterface $request |
|
239 | + * @return ResponseInterface |
|
240 | + */ |
|
241 | 241 | public function update(ServerRequestInterface $request): ResponseInterface |
242 | 242 | { |
243 | 243 | $context = []; |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $context['param']->setRoles($currentRolesId); |
262 | 262 | |
263 | 263 | $context['roles'] = $this->roleRepository->orderBy('name') |
264 | - ->all(); |
|
264 | + ->all(); |
|
265 | 265 | |
266 | 266 | $context['user_status'] = $this->statusList->getUserStatus(); |
267 | 267 | |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | } |
288 | 288 | |
289 | 289 | $usernameExist = $this->userRepository->findBy([ |
290 | - 'username' => $formParam->getUsername(), |
|
291 | - ]); |
|
290 | + 'username' => $formParam->getUsername(), |
|
291 | + ]); |
|
292 | 292 | |
293 | 293 | if ($usernameExist !== null && $usernameExist->id !== $id) { |
294 | 294 | $this->flash->setError($this->lang->tr('This username already exist')); |
@@ -301,8 +301,8 @@ discard block |
||
301 | 301 | } |
302 | 302 | |
303 | 303 | $emailExist = $this->userRepository->findBy([ |
304 | - 'email' => $formParam->getEmail(), |
|
305 | - ]); |
|
304 | + 'email' => $formParam->getEmail(), |
|
305 | + ]); |
|
306 | 306 | |
307 | 307 | if ($emailExist !== null && $emailExist->id !== $id) { |
308 | 308 | $this->flash->setError($this->lang->tr('This email already exist')); |
@@ -363,10 +363,10 @@ discard block |
||
363 | 363 | } |
364 | 364 | |
365 | 365 | /** |
366 | - * Delete the entity |
|
367 | - * @param ServerRequestInterface $request |
|
368 | - * @return ResponseInterface |
|
369 | - */ |
|
366 | + * Delete the entity |
|
367 | + * @param ServerRequestInterface $request |
|
368 | + * @return ResponseInterface |
|
369 | + */ |
|
370 | 370 | public function delete(ServerRequestInterface $request): ResponseInterface |
371 | 371 | { |
372 | 372 | $id = (int) $request->getAttribute('id'); |
@@ -30,8 +30,7 @@ |
||
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 | * Create new instance |
37 | 36 | * @param Lang $lang |
@@ -30,17 +30,17 @@ discard block |
||
30 | 30 | class UserProfileAction |
31 | 31 | { |
32 | 32 | /** |
33 | - * Create new instance |
|
34 | - * @param Lang $lang |
|
35 | - * @param AuthenticationInterface $authentication |
|
36 | - * @param Template $template |
|
37 | - * @param Flash $flash |
|
38 | - * @param RouteHelper $routeHelper |
|
39 | - * @param LoggerInterface $logger |
|
40 | - * @param StatusList $statusList |
|
41 | - * @param HashInterface $hash |
|
42 | - * @param UserRepository $userRepository |
|
43 | - */ |
|
33 | + * Create new instance |
|
34 | + * @param Lang $lang |
|
35 | + * @param AuthenticationInterface $authentication |
|
36 | + * @param Template $template |
|
37 | + * @param Flash $flash |
|
38 | + * @param RouteHelper $routeHelper |
|
39 | + * @param LoggerInterface $logger |
|
40 | + * @param StatusList $statusList |
|
41 | + * @param HashInterface $hash |
|
42 | + * @param UserRepository $userRepository |
|
43 | + */ |
|
44 | 44 | public function __construct( |
45 | 45 | protected Lang $lang, |
46 | 46 | protected AuthenticationInterface $authentication, |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
58 | - * User profile |
|
59 | - * @param ServerRequestInterface $request |
|
60 | - * @return ResponseInterface |
|
61 | - */ |
|
58 | + * User profile |
|
59 | + * @param ServerRequestInterface $request |
|
60 | + * @return ResponseInterface |
|
61 | + */ |
|
62 | 62 | public function detail(ServerRequestInterface $request): ResponseInterface |
63 | 63 | { |
64 | 64 | $context = []; |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | - * Update user profile |
|
92 | - * @param ServerRequestInterface $request |
|
93 | - * @return ResponseInterface |
|
94 | - */ |
|
91 | + * Update user profile |
|
92 | + * @param ServerRequestInterface $request |
|
93 | + * @return ResponseInterface |
|
94 | + */ |
|
95 | 95 | public function update(ServerRequestInterface $request): ResponseInterface |
96 | 96 | { |
97 | 97 | $context = []; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $user = $this->userRepository->find($id); |
104 | 104 | |
105 | 105 | if ($user === null) { |
106 | - $this->authentication->logout(); |
|
106 | + $this->authentication->logout(); |
|
107 | 107 | |
108 | 108 | $this->flash->setError($this->lang->tr('This record doesn\'t exist')); |
109 | 109 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | $usernameExist = $this->userRepository->findBy([ |
141 | - 'username' => $formParam->getUsername(), |
|
142 | - ]); |
|
141 | + 'username' => $formParam->getUsername(), |
|
142 | + ]); |
|
143 | 143 | |
144 | 144 | if ($usernameExist !== null && $usernameExist->id !== $id) { |
145 | 145 | $this->flash->setError($this->lang->tr('This username already exist')); |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | $emailExist = $this->userRepository->findBy([ |
155 | - 'email' => $formParam->getEmail(), |
|
156 | - ]); |
|
155 | + 'email' => $formParam->getEmail(), |
|
156 | + ]); |
|
157 | 157 | |
158 | 158 | if ($emailExist !== null && $emailExist->id !== $id) { |
159 | 159 | $this->flash->setError($this->lang->tr('This email already exist')); |
@@ -27,8 +27,7 @@ |
||
27 | 27 | * @class UserProfileAction |
28 | 28 | * @package Platine\App\Http\Action\User |
29 | 29 | */ |
30 | -class UserProfileAction |
|
31 | -{ |
|
30 | +class UserProfileAction { |
|
32 | 31 | /** |
33 | 32 | * Create new instance |
34 | 33 | * @param Lang $lang |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | class ProductAction |
30 | 30 | { |
31 | 31 | /** |
32 | - * Create new instance |
|
33 | - * @param Lang $lang |
|
34 | - * @param Pagination $pagination |
|
35 | - * @param Template $template |
|
36 | - * @param Flash $flash |
|
37 | - * @param RouteHelper $routeHelper |
|
38 | - * @param LoggerInterface $logger |
|
39 | - * @param ProductCategoryRepository $productCategoryRepository |
|
40 | - * @param ProductRepository $productRepository |
|
41 | - */ |
|
32 | + * Create new instance |
|
33 | + * @param Lang $lang |
|
34 | + * @param Pagination $pagination |
|
35 | + * @param Template $template |
|
36 | + * @param Flash $flash |
|
37 | + * @param RouteHelper $routeHelper |
|
38 | + * @param LoggerInterface $logger |
|
39 | + * @param ProductCategoryRepository $productCategoryRepository |
|
40 | + * @param ProductRepository $productRepository |
|
41 | + */ |
|
42 | 42 | public function __construct( |
43 | 43 | protected Lang $lang, |
44 | 44 | protected Pagination $pagination, |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | - * List all entities |
|
56 | - * @param ServerRequestInterface $request |
|
57 | - * @return ResponseInterface |
|
58 | - */ |
|
55 | + * List all entities |
|
56 | + * @param ServerRequestInterface $request |
|
57 | + * @return ResponseInterface |
|
58 | + */ |
|
59 | 59 | public function index(ServerRequestInterface $request): ResponseInterface |
60 | 60 | { |
61 | 61 | $context = []; |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | $totalItems = $this->productRepository->query() |
77 | - ->filter($filters) |
|
78 | - ->count('id'); |
|
77 | + ->filter($filters) |
|
78 | + ->count('id'); |
|
79 | 79 | |
80 | 80 | $currentPage = (int) $param->get('page', 1); |
81 | 81 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | ->all(); |
95 | 95 | |
96 | 96 | $categories = $this->productCategoryRepository->orderBy('name') |
97 | - ->all(); |
|
97 | + ->all(); |
|
98 | 98 | |
99 | 99 | $context['categories'] = $categories; |
100 | 100 | |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
114 | - * List entity detail |
|
115 | - * @param ServerRequestInterface $request |
|
116 | - * @return ResponseInterface |
|
117 | - */ |
|
114 | + * List entity detail |
|
115 | + * @param ServerRequestInterface $request |
|
116 | + * @return ResponseInterface |
|
117 | + */ |
|
118 | 118 | public function detail(ServerRequestInterface $request): ResponseInterface |
119 | 119 | { |
120 | 120 | $context = []; |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
143 | - * Create new entity |
|
144 | - * @param ServerRequestInterface $request |
|
145 | - * @return ResponseInterface |
|
146 | - */ |
|
143 | + * Create new entity |
|
144 | + * @param ServerRequestInterface $request |
|
145 | + * @return ResponseInterface |
|
146 | + */ |
|
147 | 147 | public function create(ServerRequestInterface $request): ResponseInterface |
148 | 148 | { |
149 | 149 | $context = []; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $context['param'] = $formParam; |
154 | 154 | |
155 | 155 | $categories = $this->productCategoryRepository->orderBy('name') |
156 | - ->all(); |
|
156 | + ->all(); |
|
157 | 157 | |
158 | 158 | $context['categories'] = $categories; |
159 | 159 | |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | $entityExist = $this->productRepository->findBy([ |
180 | - 'name' => $formParam->getName(), |
|
181 | - ]); |
|
180 | + 'name' => $formParam->getName(), |
|
181 | + ]); |
|
182 | 182 | |
183 | 183 | if ($entityExist !== null) { |
184 | 184 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | /** @var Product $product */ |
194 | 194 | $product = $this->productRepository->create([ |
195 | - 'name' => $formParam->getName(), |
|
195 | + 'name' => $formParam->getName(), |
|
196 | 196 | 'description' => $formParam->getDescription(), |
197 | 197 | 'price' => $formParam->getPrice(), |
198 | 198 | 'quantity' => $formParam->getQuantity(), |
@@ -221,10 +221,10 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
224 | - * Update existing entity |
|
225 | - * @param ServerRequestInterface $request |
|
226 | - * @return ResponseInterface |
|
227 | - */ |
|
224 | + * Update existing entity |
|
225 | + * @param ServerRequestInterface $request |
|
226 | + * @return ResponseInterface |
|
227 | + */ |
|
228 | 228 | public function update(ServerRequestInterface $request): ResponseInterface |
229 | 229 | { |
230 | 230 | $context = []; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $context['param'] = (new ProductParam())->fromEntity($product); |
247 | 247 | |
248 | 248 | $categories = $this->productCategoryRepository->orderBy('name') |
249 | - ->all(); |
|
249 | + ->all(); |
|
250 | 250 | |
251 | 251 | $context['categories'] = $categories; |
252 | 252 | |
@@ -272,8 +272,8 @@ discard block |
||
272 | 272 | } |
273 | 273 | |
274 | 274 | $entityExist = $this->productRepository->findBy([ |
275 | - 'name' => $formParam->getName(), |
|
276 | - ]); |
|
275 | + 'name' => $formParam->getName(), |
|
276 | + ]); |
|
277 | 277 | |
278 | 278 | if ($entityExist !== null && $entityExist->id !== $id) { |
279 | 279 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -313,10 +313,10 @@ discard block |
||
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
316 | - * Delete the entity |
|
317 | - * @param ServerRequestInterface $request |
|
318 | - * @return ResponseInterface |
|
319 | - */ |
|
316 | + * Delete the entity |
|
317 | + * @param ServerRequestInterface $request |
|
318 | + * @return ResponseInterface |
|
319 | + */ |
|
320 | 320 | public function delete(ServerRequestInterface $request): ResponseInterface |
321 | 321 | { |
322 | 322 | $id = (int) $request->getAttribute('id'); |
@@ -26,8 +26,7 @@ |
||
26 | 26 | * @class ProductAction |
27 | 27 | * @package Platine\App\Http\Action\Product |
28 | 28 | */ |
29 | -class ProductAction |
|
30 | -{ |
|
29 | +class ProductAction { |
|
31 | 30 | /** |
32 | 31 | * Create new instance |
33 | 32 | * @param Lang $lang |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | class CategoryAction |
29 | 29 | { |
30 | 30 | /** |
31 | - * Create new instance |
|
32 | - * @param Lang $lang |
|
33 | - * @param Pagination $pagination |
|
34 | - * @param Template $template |
|
35 | - * @param Flash $flash |
|
36 | - * @param RouteHelper $routeHelper |
|
37 | - * @param LoggerInterface $logger |
|
38 | - * @param ProductCategoryRepository $productCategoryRepository |
|
39 | - */ |
|
31 | + * Create new instance |
|
32 | + * @param Lang $lang |
|
33 | + * @param Pagination $pagination |
|
34 | + * @param Template $template |
|
35 | + * @param Flash $flash |
|
36 | + * @param RouteHelper $routeHelper |
|
37 | + * @param LoggerInterface $logger |
|
38 | + * @param ProductCategoryRepository $productCategoryRepository |
|
39 | + */ |
|
40 | 40 | public function __construct( |
41 | 41 | protected Lang $lang, |
42 | 42 | protected Pagination $pagination, |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | - * List all entities |
|
53 | - * @param ServerRequestInterface $request |
|
54 | - * @return ResponseInterface |
|
55 | - */ |
|
52 | + * List all entities |
|
53 | + * @param ServerRequestInterface $request |
|
54 | + * @return ResponseInterface |
|
55 | + */ |
|
56 | 56 | public function index(ServerRequestInterface $request): ResponseInterface |
57 | 57 | { |
58 | 58 | $context = []; |
59 | 59 | $param = new RequestData($request); |
60 | 60 | $totalItems = $this->productCategoryRepository->query() |
61 | - ->count('id'); |
|
61 | + ->count('id'); |
|
62 | 62 | |
63 | 63 | $currentPage = (int) $param->get('page', 1); |
64 | 64 | |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | - * List entity detail |
|
90 | - * @param ServerRequestInterface $request |
|
91 | - * @return ResponseInterface |
|
92 | - */ |
|
89 | + * List entity detail |
|
90 | + * @param ServerRequestInterface $request |
|
91 | + * @return ResponseInterface |
|
92 | + */ |
|
93 | 93 | public function detail(ServerRequestInterface $request): ResponseInterface |
94 | 94 | { |
95 | 95 | $context = []; |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Create new entity |
|
119 | - * @param ServerRequestInterface $request |
|
120 | - * @return ResponseInterface |
|
121 | - */ |
|
118 | + * Create new entity |
|
119 | + * @param ServerRequestInterface $request |
|
120 | + * @return ResponseInterface |
|
121 | + */ |
|
122 | 122 | public function create(ServerRequestInterface $request): ResponseInterface |
123 | 123 | { |
124 | 124 | $context = []; |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | $entityExist = $this->productCategoryRepository->findBy([ |
150 | - 'name' => $formParam->getName(), |
|
151 | - ]); |
|
150 | + 'name' => $formParam->getName(), |
|
151 | + ]); |
|
152 | 152 | |
153 | 153 | if ($entityExist !== null) { |
154 | 154 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | /** @var ProductCategory $category */ |
164 | 164 | $category = $this->productCategoryRepository->create([ |
165 | - 'name' => $formParam->getName(), |
|
165 | + 'name' => $formParam->getName(), |
|
166 | 166 | 'description' => $formParam->getDescription(), |
167 | 167 | ]); |
168 | 168 | |
@@ -188,10 +188,10 @@ discard block |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
191 | - * Update existing entity |
|
192 | - * @param ServerRequestInterface $request |
|
193 | - * @return ResponseInterface |
|
194 | - */ |
|
191 | + * Update existing entity |
|
192 | + * @param ServerRequestInterface $request |
|
193 | + * @return ResponseInterface |
|
194 | + */ |
|
195 | 195 | public function update(ServerRequestInterface $request): ResponseInterface |
196 | 196 | { |
197 | 197 | $context = []; |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | } |
234 | 234 | |
235 | 235 | $entityExist = $this->productCategoryRepository->findBy([ |
236 | - 'name' => $formParam->getName(), |
|
237 | - ]); |
|
236 | + 'name' => $formParam->getName(), |
|
237 | + ]); |
|
238 | 238 | |
239 | 239 | if ($entityExist !== null && $entityExist->id !== $id) { |
240 | 240 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
274 | - * Delete the entity |
|
275 | - * @param ServerRequestInterface $request |
|
276 | - * @return ResponseInterface |
|
277 | - */ |
|
274 | + * Delete the entity |
|
275 | + * @param ServerRequestInterface $request |
|
276 | + * @return ResponseInterface |
|
277 | + */ |
|
278 | 278 | public function delete(ServerRequestInterface $request): ResponseInterface |
279 | 279 | { |
280 | 280 | $id = (int) $request->getAttribute('id'); |
@@ -25,8 +25,7 @@ |
||
25 | 25 | * @class CategoryAction |
26 | 26 | * @package Platine\App\Http\Action\Product |
27 | 27 | */ |
28 | -class CategoryAction |
|
29 | -{ |
|
28 | +class CategoryAction { |
|
30 | 29 | /** |
31 | 30 | * Create new instance |
32 | 31 | * @param Lang $lang |
@@ -31,17 +31,17 @@ discard block |
||
31 | 31 | class RoleAction |
32 | 32 | { |
33 | 33 | /** |
34 | - * Create new instance |
|
35 | - * @param Lang $lang |
|
36 | - * @param Pagination $pagination |
|
37 | - * @param Template $template |
|
38 | - * @param Flash $flash |
|
39 | - * @param RouteHelper $routeHelper |
|
40 | - * @param LoggerInterface $logger |
|
41 | - * @param PermissionRepository $permissionRepository |
|
42 | - * @param RoleRepository $roleRepository |
|
43 | - * @param StatusList $statusList |
|
44 | - */ |
|
34 | + * Create new instance |
|
35 | + * @param Lang $lang |
|
36 | + * @param Pagination $pagination |
|
37 | + * @param Template $template |
|
38 | + * @param Flash $flash |
|
39 | + * @param RouteHelper $routeHelper |
|
40 | + * @param LoggerInterface $logger |
|
41 | + * @param PermissionRepository $permissionRepository |
|
42 | + * @param RoleRepository $roleRepository |
|
43 | + * @param StatusList $statusList |
|
44 | + */ |
|
45 | 45 | public function __construct( |
46 | 46 | protected Lang $lang, |
47 | 47 | protected Pagination $pagination, |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | - * List all entities |
|
60 | - * @param ServerRequestInterface $request |
|
61 | - * @return ResponseInterface |
|
62 | - */ |
|
59 | + * List all entities |
|
60 | + * @param ServerRequestInterface $request |
|
61 | + * @return ResponseInterface |
|
62 | + */ |
|
63 | 63 | public function index(ServerRequestInterface $request): ResponseInterface |
64 | 64 | { |
65 | 65 | $context = []; |
66 | 66 | $param = new RequestData($request); |
67 | 67 | $totalItems = $this->roleRepository->query() |
68 | - ->count('id'); |
|
68 | + ->count('id'); |
|
69 | 69 | |
70 | 70 | $currentPage = (int) $param->get('page', 1); |
71 | 71 | |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
96 | - * List entity detail |
|
97 | - * @param ServerRequestInterface $request |
|
98 | - * @return ResponseInterface |
|
99 | - */ |
|
96 | + * List entity detail |
|
97 | + * @param ServerRequestInterface $request |
|
98 | + * @return ResponseInterface |
|
99 | + */ |
|
100 | 100 | public function detail(ServerRequestInterface $request): ResponseInterface |
101 | 101 | { |
102 | 102 | $context = []; |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
126 | - * Create new entity |
|
127 | - * @param ServerRequestInterface $request |
|
128 | - * @return ResponseInterface |
|
129 | - */ |
|
126 | + * Create new entity |
|
127 | + * @param ServerRequestInterface $request |
|
128 | + * @return ResponseInterface |
|
129 | + */ |
|
130 | 130 | public function create(ServerRequestInterface $request): ResponseInterface |
131 | 131 | { |
132 | 132 | $context = []; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $context['param'] = $formParam; |
137 | 137 | |
138 | 138 | $permissions = $this->permissionRepository->orderBy('code') |
139 | - ->all(); |
|
139 | + ->all(); |
|
140 | 140 | |
141 | 141 | $context['permissions'] = $permissions; |
142 | 142 | |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | $entityExist = $this->roleRepository->findBy([ |
163 | - 'name' => $formParam->getName(), |
|
164 | - ]); |
|
163 | + 'name' => $formParam->getName(), |
|
164 | + ]); |
|
165 | 165 | |
166 | 166 | if ($entityExist !== null) { |
167 | 167 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | /** @var Role $role */ |
177 | 177 | $role = $this->roleRepository->create([ |
178 | - 'name' => $formParam->getName(), |
|
178 | + 'name' => $formParam->getName(), |
|
179 | 179 | 'description' => $formParam->getDescription(), |
180 | 180 | ]); |
181 | 181 | |
@@ -207,10 +207,10 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
210 | - * Update existing entity |
|
211 | - * @param ServerRequestInterface $request |
|
212 | - * @return ResponseInterface |
|
213 | - */ |
|
210 | + * Update existing entity |
|
211 | + * @param ServerRequestInterface $request |
|
212 | + * @return ResponseInterface |
|
213 | + */ |
|
214 | 214 | public function update(ServerRequestInterface $request): ResponseInterface |
215 | 215 | { |
216 | 216 | $context = []; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $context['param']->setPermissions($currentPermissionsId); |
236 | 236 | |
237 | 237 | $permissions = $this->permissionRepository->orderBy('code') |
238 | - ->all(); |
|
238 | + ->all(); |
|
239 | 239 | |
240 | 240 | $context['permissions'] = $permissions; |
241 | 241 | |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | $entityExist = $this->roleRepository->findBy([ |
264 | - 'name' => $formParam->getName(), |
|
265 | - ]); |
|
264 | + 'name' => $formParam->getName(), |
|
265 | + ]); |
|
266 | 266 | |
267 | 267 | if ($entityExist !== null && $entityExist->id !== $id) { |
268 | 268 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
318 | - * Delete the entity |
|
319 | - * @param ServerRequestInterface $request |
|
320 | - * @return ResponseInterface |
|
321 | - */ |
|
318 | + * Delete the entity |
|
319 | + * @param ServerRequestInterface $request |
|
320 | + * @return ResponseInterface |
|
321 | + */ |
|
322 | 322 | public function delete(ServerRequestInterface $request): ResponseInterface |
323 | 323 | { |
324 | 324 | $id = (int) $request->getAttribute('id'); |
@@ -28,8 +28,7 @@ |
||
28 | 28 | * @class RoleAction |
29 | 29 | * @package Platine\App\Http\Action\Role |
30 | 30 | */ |
31 | -class RoleAction |
|
32 | -{ |
|
31 | +class RoleAction { |
|
33 | 32 | /** |
34 | 33 | * Create new instance |
35 | 34 | * @param Lang $lang |
@@ -11,14 +11,12 @@ |
||
11 | 11 | * @class AuthParam |
12 | 12 | * @package Platine\App\Param |
13 | 13 | */ |
14 | -class StatusList |
|
15 | -{ |
|
14 | +class StatusList { |
|
16 | 15 | /** |
17 | 16 | * Create new instance |
18 | 17 | * @param Lang $lang |
19 | 18 | */ |
20 | - public function __construct(protected Lang $lang) |
|
21 | - { |
|
19 | + public function __construct(protected Lang $lang) { |
|
22 | 20 | } |
23 | 21 | |
24 | 22 | /** |
@@ -11,15 +11,15 @@ discard block |
||
11 | 11 | { |
12 | 12 | public function up(): void |
13 | 13 | { |
14 | - //Action when migrate up |
|
14 | + //Action when migrate up |
|
15 | 15 | $this->create('configurations', function (CreateTable $table) { |
16 | 16 | $table->integer('id') |
17 | 17 | ->autoincrement() |
18 | 18 | ->primary(); |
19 | 19 | |
20 | 20 | $table->string('env') |
21 | - ->description('The config environment') |
|
22 | - ->index(); |
|
21 | + ->description('The config environment') |
|
22 | + ->index(); |
|
23 | 23 | |
24 | 24 | $table->string('module') |
25 | 25 | ->description('The module') |
@@ -27,24 +27,24 @@ discard block |
||
27 | 27 | ->notNull(); |
28 | 28 | |
29 | 29 | $table->string('name') |
30 | - ->description('The config name') |
|
31 | - ->index() |
|
32 | - ->notNull(); |
|
30 | + ->description('The config name') |
|
31 | + ->index() |
|
32 | + ->notNull(); |
|
33 | 33 | |
34 | 34 | $table->text('value') |
35 | 35 | ->description('The config value'); |
36 | 36 | |
37 | 37 | $table->string('type') |
38 | - ->description('The config data type') |
|
39 | - ->notNull(); |
|
38 | + ->description('The config data type') |
|
39 | + ->notNull(); |
|
40 | 40 | |
41 | 41 | $table->text('comment') |
42 | - ->description('The config description'); |
|
42 | + ->description('The config description'); |
|
43 | 43 | |
44 | 44 | $table->enum('status', ['Y', 'N']) |
45 | - ->description('The config status') |
|
46 | - ->defaultValue('Y') |
|
47 | - ->notNull(); |
|
45 | + ->description('The config status') |
|
46 | + ->defaultValue('Y') |
|
47 | + ->notNull(); |
|
48 | 48 | |
49 | 49 | $table->timestamps(); |
50 | 50 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function down(): void |
56 | 56 | { |
57 | - //Action when migrate down |
|
57 | + //Action when migrate down |
|
58 | 58 | $this->drop('configurations'); |
59 | 59 | } |
60 | 60 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | public function up(): void |
13 | 13 | { |
14 | 14 | //Action when migrate up |
15 | - $this->create('configurations', function (CreateTable $table) { |
|
15 | + $this->create('configurations', function(CreateTable $table) { |
|
16 | 16 | $table->integer('id') |
17 | 17 | ->autoincrement() |
18 | 18 | ->primary(); |
@@ -7,12 +7,11 @@ |
||
7 | 7 | use Platine\Database\Schema\CreateTable; |
8 | 8 | use Platine\Framework\Migration\AbstractMigration; |
9 | 9 | |
10 | -class AddConfigurationTable20220109074106 extends AbstractMigration |
|
11 | -{ |
|
10 | +class AddConfigurationTable20220109074106 extends AbstractMigration { |
|
12 | 11 | public function up(): void |
13 | 12 | { |
14 | 13 | //Action when migrate up |
15 | - $this->create('configurations', function (CreateTable $table) { |
|
14 | + $this->create('configurations', function (CreateTable $table) { |
|
16 | 15 | $table->integer('id') |
17 | 16 | ->autoincrement() |
18 | 17 | ->primary(); |