@@ -13,6 +13,6 @@ |
||
13 | 13 | CsrfMiddleware::class, |
14 | 14 | AuthenticationMiddleware::class, |
15 | 15 | AuthorizationMiddleware::class, |
16 | - // SecurityPolicyMiddleware::class, |
|
16 | + // SecurityPolicyMiddleware::class, |
|
17 | 17 | RouteDispatcherMiddleware::class, |
18 | 18 | ]; |
@@ -15,28 +15,28 @@ discard block |
||
15 | 15 | class PermissionParam extends BaseParam |
16 | 16 | { |
17 | 17 | /** |
18 | - * The code field |
|
19 | - * @var string |
|
20 | - */ |
|
18 | + * The code field |
|
19 | + * @var string |
|
20 | + */ |
|
21 | 21 | protected string $code; |
22 | 22 | |
23 | 23 | /** |
24 | - * The description field |
|
25 | - * @var string |
|
26 | - */ |
|
24 | + * The description field |
|
25 | + * @var string |
|
26 | + */ |
|
27 | 27 | protected string $description; |
28 | 28 | |
29 | 29 | /** |
30 | - * The depend field |
|
31 | - * @var string|null |
|
32 | - */ |
|
30 | + * The depend field |
|
31 | + * @var string|null |
|
32 | + */ |
|
33 | 33 | protected ?string $depend = null; |
34 | 34 | |
35 | 35 | |
36 | 36 | /** |
37 | - * @param TEntity $entity |
|
38 | - * @return $this |
|
39 | - */ |
|
37 | + * @param TEntity $entity |
|
38 | + * @return $this |
|
39 | + */ |
|
40 | 40 | public function fromEntity(Entity $entity): self |
41 | 41 | { |
42 | 42 | $this->code = $entity->code; |
@@ -47,27 +47,27 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | - * Return the code value |
|
51 | - * @return string |
|
52 | - */ |
|
50 | + * Return the code value |
|
51 | + * @return string |
|
52 | + */ |
|
53 | 53 | public function getCode(): string |
54 | 54 | { |
55 | 55 | return $this->code; |
56 | 56 | } |
57 | 57 | |
58 | - /** |
|
59 | - * Return the description value |
|
60 | - * @return string |
|
61 | - */ |
|
58 | + /** |
|
59 | + * Return the description value |
|
60 | + * @return string |
|
61 | + */ |
|
62 | 62 | public function getDescription(): string |
63 | 63 | { |
64 | 64 | return $this->description; |
65 | 65 | } |
66 | 66 | |
67 | - /** |
|
68 | - * Return the depend value |
|
69 | - * @return string|null |
|
70 | - */ |
|
67 | + /** |
|
68 | + * Return the depend value |
|
69 | + * @return string|null |
|
70 | + */ |
|
71 | 71 | public function getDepend(): ?string |
72 | 72 | { |
73 | 73 | return $this->depend; |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | |
76 | 76 | |
77 | 77 | /** |
78 | - * Set the code value |
|
79 | - * @param string $code |
|
80 | - * @return $this |
|
81 | - */ |
|
78 | + * Set the code value |
|
79 | + * @param string $code |
|
80 | + * @return $this |
|
81 | + */ |
|
82 | 82 | public function setCode(string $code): self |
83 | 83 | { |
84 | 84 | $this->code = $code; |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | return $this; |
87 | 87 | } |
88 | 88 | |
89 | - /** |
|
90 | - * Set the description value |
|
91 | - * @param string $description |
|
92 | - * @return $this |
|
93 | - */ |
|
89 | + /** |
|
90 | + * Set the description value |
|
91 | + * @param string $description |
|
92 | + * @return $this |
|
93 | + */ |
|
94 | 94 | public function setDescription(string $description): self |
95 | 95 | { |
96 | 96 | $this->description = $description; |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | return $this; |
99 | 99 | } |
100 | 100 | |
101 | - /** |
|
102 | - * Set the depend value |
|
103 | - * @param string|null $depend |
|
104 | - * @return $this |
|
105 | - */ |
|
101 | + /** |
|
102 | + * Set the depend value |
|
103 | + * @param string|null $depend |
|
104 | + * @return $this |
|
105 | + */ |
|
106 | 106 | public function setDepend(?string $depend): self |
107 | 107 | { |
108 | 108 | $this->depend = $depend; |
@@ -12,8 +12,7 @@ |
||
12 | 12 | * @package Platine\App\Param |
13 | 13 | * @template TEntity as Entity |
14 | 14 | */ |
15 | -class PermissionParam extends BaseParam |
|
16 | -{ |
|
15 | +class PermissionParam extends BaseParam { |
|
17 | 16 | /** |
18 | 17 | * The code field |
19 | 18 | * @var string |
@@ -14,32 +14,32 @@ discard block |
||
14 | 14 | class AuthParam extends BaseParam |
15 | 15 | { |
16 | 16 | /** |
17 | - * The username field |
|
18 | - * @var string |
|
19 | - */ |
|
17 | + * The username field |
|
18 | + * @var string |
|
19 | + */ |
|
20 | 20 | protected string $username; |
21 | 21 | |
22 | 22 | /** |
23 | - * The password field |
|
24 | - * @var string |
|
25 | - */ |
|
23 | + * The password field |
|
24 | + * @var string |
|
25 | + */ |
|
26 | 26 | protected string $password; |
27 | 27 | |
28 | 28 | |
29 | 29 | |
30 | 30 | /** |
31 | - * Return the username value |
|
32 | - * @return string |
|
33 | - */ |
|
31 | + * Return the username value |
|
32 | + * @return string |
|
33 | + */ |
|
34 | 34 | public function getUsername(): string |
35 | 35 | { |
36 | 36 | return $this->username; |
37 | 37 | } |
38 | 38 | |
39 | - /** |
|
40 | - * Return the password value |
|
41 | - * @return string |
|
42 | - */ |
|
39 | + /** |
|
40 | + * Return the password value |
|
41 | + * @return string |
|
42 | + */ |
|
43 | 43 | public function getPassword(): string |
44 | 44 | { |
45 | 45 | return $this->password; |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | |
48 | 48 | |
49 | 49 | /** |
50 | - * Set the username value |
|
51 | - * @param string $username |
|
52 | - * @return $this |
|
53 | - */ |
|
50 | + * Set the username value |
|
51 | + * @param string $username |
|
52 | + * @return $this |
|
53 | + */ |
|
54 | 54 | public function setUsername(string $username): self |
55 | 55 | { |
56 | 56 | $this->username = $username; |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | return $this; |
59 | 59 | } |
60 | 60 | |
61 | - /** |
|
62 | - * Set the password value |
|
63 | - * @param string $password |
|
64 | - * @return $this |
|
65 | - */ |
|
61 | + /** |
|
62 | + * Set the password value |
|
63 | + * @param string $password |
|
64 | + * @return $this |
|
65 | + */ |
|
66 | 66 | public function setPassword(string $password): self |
67 | 67 | { |
68 | 68 | $this->password = $password; |
@@ -11,8 +11,7 @@ |
||
11 | 11 | * @package Platine\App\Param |
12 | 12 | * |
13 | 13 | */ |
14 | -class AuthParam extends BaseParam |
|
15 | -{ |
|
14 | +class AuthParam extends BaseParam { |
|
16 | 15 | /** |
17 | 16 | * The username field |
18 | 17 | * @var string |
@@ -15,28 +15,28 @@ discard block |
||
15 | 15 | class RoleParam extends BaseParam |
16 | 16 | { |
17 | 17 | /** |
18 | - * The name field |
|
19 | - * @var string |
|
20 | - */ |
|
18 | + * The name field |
|
19 | + * @var string |
|
20 | + */ |
|
21 | 21 | protected string $name; |
22 | 22 | |
23 | 23 | /** |
24 | - * The description field |
|
25 | - * @var string|null |
|
26 | - */ |
|
24 | + * The description field |
|
25 | + * @var string|null |
|
26 | + */ |
|
27 | 27 | protected ?string $description = null; |
28 | 28 | |
29 | 29 | /** |
30 | - * The permissions field |
|
31 | - * @var array<int> |
|
32 | - */ |
|
30 | + * The permissions field |
|
31 | + * @var array<int> |
|
32 | + */ |
|
33 | 33 | protected array $permissions = []; |
34 | 34 | |
35 | 35 | |
36 | 36 | /** |
37 | - * @param TEntity $entity |
|
38 | - * @return $this |
|
39 | - */ |
|
37 | + * @param TEntity $entity |
|
38 | + * @return $this |
|
39 | + */ |
|
40 | 40 | public function fromEntity(Entity $entity): self |
41 | 41 | { |
42 | 42 | $this->name = $entity->name; |
@@ -46,27 +46,27 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
49 | - * Return the name value |
|
50 | - * @return string |
|
51 | - */ |
|
49 | + * Return the name value |
|
50 | + * @return string |
|
51 | + */ |
|
52 | 52 | public function getName(): string |
53 | 53 | { |
54 | 54 | return $this->name; |
55 | 55 | } |
56 | 56 | |
57 | - /** |
|
58 | - * Return the description value |
|
59 | - * @return string|null |
|
60 | - */ |
|
57 | + /** |
|
58 | + * Return the description value |
|
59 | + * @return string|null |
|
60 | + */ |
|
61 | 61 | public function getDescription(): ?string |
62 | 62 | { |
63 | 63 | return $this->description; |
64 | 64 | } |
65 | 65 | |
66 | - /** |
|
67 | - * Return the permissions value |
|
68 | - * @return array<int> |
|
69 | - */ |
|
66 | + /** |
|
67 | + * Return the permissions value |
|
68 | + * @return array<int> |
|
69 | + */ |
|
70 | 70 | public function getPermissions(): array |
71 | 71 | { |
72 | 72 | return $this->permissions; |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | |
75 | 75 | |
76 | 76 | /** |
77 | - * Set the name value |
|
78 | - * @param string $name |
|
79 | - * @return $this |
|
80 | - */ |
|
77 | + * Set the name value |
|
78 | + * @param string $name |
|
79 | + * @return $this |
|
80 | + */ |
|
81 | 81 | public function setName(string $name): self |
82 | 82 | { |
83 | 83 | $this->name = $name; |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | return $this; |
86 | 86 | } |
87 | 87 | |
88 | - /** |
|
89 | - * Set the description value |
|
90 | - * @param string|null $description |
|
91 | - * @return $this |
|
92 | - */ |
|
88 | + /** |
|
89 | + * Set the description value |
|
90 | + * @param string|null $description |
|
91 | + * @return $this |
|
92 | + */ |
|
93 | 93 | public function setDescription(?string $description): self |
94 | 94 | { |
95 | 95 | $this->description = $description; |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | return $this; |
98 | 98 | } |
99 | 99 | |
100 | - /** |
|
101 | - * Set the permissions value |
|
102 | - * @param array<int> $permissions |
|
103 | - * @return $this |
|
104 | - */ |
|
100 | + /** |
|
101 | + * Set the permissions value |
|
102 | + * @param array<int> $permissions |
|
103 | + * @return $this |
|
104 | + */ |
|
105 | 105 | public function setPermissions(array $permissions): self |
106 | 106 | { |
107 | 107 | $this->permissions = $permissions; |
@@ -12,8 +12,7 @@ |
||
12 | 12 | * @package Platine\App\Param |
13 | 13 | * @template TEntity as Entity |
14 | 14 | */ |
15 | -class RoleParam extends BaseParam |
|
16 | -{ |
|
15 | +class RoleParam extends BaseParam { |
|
17 | 16 | /** |
18 | 17 | * The name field |
19 | 18 | * @var string |
@@ -39,6 +39,5 @@ |
||
39 | 39 | * @class ApplicationException |
40 | 40 | * @package Platine\App\Exception |
41 | 41 | */ |
42 | -class ApplicationException extends Exception |
|
43 | -{ |
|
42 | +class ApplicationException extends Exception { |
|
44 | 43 | } |
@@ -31,71 +31,71 @@ discard block |
||
31 | 31 | class RoleAction |
32 | 32 | { |
33 | 33 | /** |
34 | - * The Lang instance |
|
35 | - * @var Lang |
|
36 | - */ |
|
34 | + * The Lang instance |
|
35 | + * @var Lang |
|
36 | + */ |
|
37 | 37 | protected Lang $lang; |
38 | 38 | |
39 | 39 | /** |
40 | - * The Pagination instance |
|
41 | - * @var Pagination |
|
42 | - */ |
|
40 | + * The Pagination instance |
|
41 | + * @var Pagination |
|
42 | + */ |
|
43 | 43 | protected Pagination $pagination; |
44 | 44 | |
45 | 45 | /** |
46 | - * The Template instance |
|
47 | - * @var Template |
|
48 | - */ |
|
46 | + * The Template instance |
|
47 | + * @var Template |
|
48 | + */ |
|
49 | 49 | protected Template $template; |
50 | 50 | |
51 | 51 | /** |
52 | - * The Flash instance |
|
53 | - * @var Flash |
|
54 | - */ |
|
52 | + * The Flash instance |
|
53 | + * @var Flash |
|
54 | + */ |
|
55 | 55 | protected Flash $flash; |
56 | 56 | |
57 | 57 | /** |
58 | - * The RouteHelper instance |
|
59 | - * @var RouteHelper |
|
60 | - */ |
|
58 | + * The RouteHelper instance |
|
59 | + * @var RouteHelper |
|
60 | + */ |
|
61 | 61 | protected RouteHelper $routeHelper; |
62 | 62 | |
63 | 63 | /** |
64 | - * The LoggerInterface instance |
|
65 | - * @var LoggerInterface |
|
66 | - */ |
|
64 | + * The LoggerInterface instance |
|
65 | + * @var LoggerInterface |
|
66 | + */ |
|
67 | 67 | protected LoggerInterface $logger; |
68 | 68 | |
69 | 69 | /** |
70 | - * The PermissionRepository instance |
|
71 | - * @var PermissionRepository |
|
72 | - */ |
|
70 | + * The PermissionRepository instance |
|
71 | + * @var PermissionRepository |
|
72 | + */ |
|
73 | 73 | protected PermissionRepository $permissionRepository; |
74 | 74 | |
75 | 75 | /** |
76 | - * The RoleRepository instance |
|
77 | - * @var RoleRepository |
|
78 | - */ |
|
76 | + * The RoleRepository instance |
|
77 | + * @var RoleRepository |
|
78 | + */ |
|
79 | 79 | protected RoleRepository $roleRepository; |
80 | 80 | |
81 | 81 | /** |
82 | - * The StatusList instance |
|
83 | - * @var StatusList |
|
84 | - */ |
|
82 | + * The StatusList instance |
|
83 | + * @var StatusList |
|
84 | + */ |
|
85 | 85 | protected StatusList $statusList; |
86 | 86 | |
87 | 87 | /** |
88 | - * Create new instance |
|
89 | - * @param Lang $lang |
|
90 | - * @param Pagination $pagination |
|
91 | - * @param Template $template |
|
92 | - * @param Flash $flash |
|
93 | - * @param RouteHelper $routeHelper |
|
94 | - * @param LoggerInterface $logger |
|
95 | - * @param PermissionRepository $permissionRepository |
|
96 | - * @param RoleRepository $roleRepository |
|
97 | - * @param StatusList $statusList |
|
98 | - */ |
|
88 | + * Create new instance |
|
89 | + * @param Lang $lang |
|
90 | + * @param Pagination $pagination |
|
91 | + * @param Template $template |
|
92 | + * @param Flash $flash |
|
93 | + * @param RouteHelper $routeHelper |
|
94 | + * @param LoggerInterface $logger |
|
95 | + * @param PermissionRepository $permissionRepository |
|
96 | + * @param RoleRepository $roleRepository |
|
97 | + * @param StatusList $statusList |
|
98 | + */ |
|
99 | 99 | public function __construct( |
100 | 100 | Lang $lang, |
101 | 101 | Pagination $pagination, |
@@ -119,16 +119,16 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
122 | - * List all entities |
|
123 | - * @param ServerRequestInterface $request |
|
124 | - * @return ResponseInterface |
|
125 | - */ |
|
122 | + * List all entities |
|
123 | + * @param ServerRequestInterface $request |
|
124 | + * @return ResponseInterface |
|
125 | + */ |
|
126 | 126 | public function index(ServerRequestInterface $request): ResponseInterface |
127 | 127 | { |
128 | 128 | $context = []; |
129 | 129 | $param = new RequestData($request); |
130 | 130 | $totalItems = $this->roleRepository->query() |
131 | - ->count('id'); |
|
131 | + ->count('id'); |
|
132 | 132 | |
133 | 133 | $currentPage = (int) $param->get('page', 1); |
134 | 134 | |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
159 | - * List entity detail |
|
160 | - * @param ServerRequestInterface $request |
|
161 | - * @return ResponseInterface |
|
162 | - */ |
|
159 | + * List entity detail |
|
160 | + * @param ServerRequestInterface $request |
|
161 | + * @return ResponseInterface |
|
162 | + */ |
|
163 | 163 | public function detail(ServerRequestInterface $request): ResponseInterface |
164 | 164 | { |
165 | 165 | $context = []; |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
189 | - * Create new entity |
|
190 | - * @param ServerRequestInterface $request |
|
191 | - * @return ResponseInterface |
|
192 | - */ |
|
189 | + * Create new entity |
|
190 | + * @param ServerRequestInterface $request |
|
191 | + * @return ResponseInterface |
|
192 | + */ |
|
193 | 193 | public function create(ServerRequestInterface $request): ResponseInterface |
194 | 194 | { |
195 | 195 | $context = []; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $context['param'] = $formParam; |
200 | 200 | |
201 | 201 | $permissions = $this->permissionRepository->orderBy('code') |
202 | - ->all(); |
|
202 | + ->all(); |
|
203 | 203 | |
204 | 204 | $context['permissions'] = $permissions; |
205 | 205 | |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | } |
224 | 224 | |
225 | 225 | $entityExist = $this->roleRepository->findBy([ |
226 | - 'name' => $formParam->getName(), |
|
227 | - ]); |
|
226 | + 'name' => $formParam->getName(), |
|
227 | + ]); |
|
228 | 228 | |
229 | 229 | if ($entityExist !== null) { |
230 | 230 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | |
239 | 239 | /** @var Role $role */ |
240 | 240 | $role = $this->roleRepository->create([ |
241 | - 'name' => $formParam->getName(), |
|
241 | + 'name' => $formParam->getName(), |
|
242 | 242 | 'description' => $formParam->getDescription(), |
243 | 243 | ]); |
244 | 244 | |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
273 | - * Update existing entity |
|
274 | - * @param ServerRequestInterface $request |
|
275 | - * @return ResponseInterface |
|
276 | - */ |
|
273 | + * Update existing entity |
|
274 | + * @param ServerRequestInterface $request |
|
275 | + * @return ResponseInterface |
|
276 | + */ |
|
277 | 277 | public function update(ServerRequestInterface $request): ResponseInterface |
278 | 278 | { |
279 | 279 | $context = []; |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $context['param']->setPermissions($currentPermissionsId); |
299 | 299 | |
300 | 300 | $permissions = $this->permissionRepository->orderBy('code') |
301 | - ->all(); |
|
301 | + ->all(); |
|
302 | 302 | |
303 | 303 | $context['permissions'] = $permissions; |
304 | 304 | |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | $entityExist = $this->roleRepository->findBy([ |
327 | - 'name' => $formParam->getName(), |
|
328 | - ]); |
|
327 | + 'name' => $formParam->getName(), |
|
328 | + ]); |
|
329 | 329 | |
330 | 330 | if ($entityExist !== null && $entityExist->id !== $id) { |
331 | 331 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | } |
379 | 379 | |
380 | 380 | /** |
381 | - * Delete the entity |
|
382 | - * @param ServerRequestInterface $request |
|
383 | - * @return ResponseInterface |
|
384 | - */ |
|
381 | + * Delete the entity |
|
382 | + * @param ServerRequestInterface $request |
|
383 | + * @return ResponseInterface |
|
384 | + */ |
|
385 | 385 | public function delete(ServerRequestInterface $request): ResponseInterface |
386 | 386 | { |
387 | 387 | $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 | * The Lang instance |
35 | 34 | * @var Lang |
@@ -28,59 +28,59 @@ discard block |
||
28 | 28 | class PermissionAction |
29 | 29 | { |
30 | 30 | /** |
31 | - * The Lang instance |
|
32 | - * @var Lang |
|
33 | - */ |
|
31 | + * The Lang instance |
|
32 | + * @var Lang |
|
33 | + */ |
|
34 | 34 | protected Lang $lang; |
35 | 35 | |
36 | 36 | /** |
37 | - * The Pagination instance |
|
38 | - * @var Pagination |
|
39 | - */ |
|
37 | + * The Pagination instance |
|
38 | + * @var Pagination |
|
39 | + */ |
|
40 | 40 | protected Pagination $pagination; |
41 | 41 | |
42 | 42 | /** |
43 | - * The Template instance |
|
44 | - * @var Template |
|
45 | - */ |
|
43 | + * The Template instance |
|
44 | + * @var Template |
|
45 | + */ |
|
46 | 46 | protected Template $template; |
47 | 47 | |
48 | 48 | /** |
49 | - * The Flash instance |
|
50 | - * @var Flash |
|
51 | - */ |
|
49 | + * The Flash instance |
|
50 | + * @var Flash |
|
51 | + */ |
|
52 | 52 | protected Flash $flash; |
53 | 53 | |
54 | 54 | /** |
55 | - * The RouteHelper instance |
|
56 | - * @var RouteHelper |
|
57 | - */ |
|
55 | + * The RouteHelper instance |
|
56 | + * @var RouteHelper |
|
57 | + */ |
|
58 | 58 | protected RouteHelper $routeHelper; |
59 | 59 | |
60 | 60 | /** |
61 | - * The LoggerInterface instance |
|
62 | - * @var LoggerInterface |
|
63 | - */ |
|
61 | + * The LoggerInterface instance |
|
62 | + * @var LoggerInterface |
|
63 | + */ |
|
64 | 64 | protected LoggerInterface $logger; |
65 | 65 | |
66 | 66 | /** |
67 | - * The PermissionRepository instance |
|
68 | - * @var PermissionRepository |
|
69 | - */ |
|
67 | + * The PermissionRepository instance |
|
68 | + * @var PermissionRepository |
|
69 | + */ |
|
70 | 70 | protected PermissionRepository $permissionRepository; |
71 | 71 | |
72 | 72 | |
73 | 73 | |
74 | 74 | /** |
75 | - * Create new instance |
|
76 | - * @param Lang $lang |
|
77 | - * @param Pagination $pagination |
|
78 | - * @param Template $template |
|
79 | - * @param Flash $flash |
|
80 | - * @param RouteHelper $routeHelper |
|
81 | - * @param LoggerInterface $logger |
|
82 | - * @param PermissionRepository $permissionRepository |
|
83 | - */ |
|
75 | + * Create new instance |
|
76 | + * @param Lang $lang |
|
77 | + * @param Pagination $pagination |
|
78 | + * @param Template $template |
|
79 | + * @param Flash $flash |
|
80 | + * @param RouteHelper $routeHelper |
|
81 | + * @param LoggerInterface $logger |
|
82 | + * @param PermissionRepository $permissionRepository |
|
83 | + */ |
|
84 | 84 | public function __construct( |
85 | 85 | Lang $lang, |
86 | 86 | Pagination $pagination, |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | - * List all entities |
|
104 | - * @param ServerRequestInterface $request |
|
105 | - * @return ResponseInterface |
|
106 | - */ |
|
103 | + * List all entities |
|
104 | + * @param ServerRequestInterface $request |
|
105 | + * @return ResponseInterface |
|
106 | + */ |
|
107 | 107 | public function index(ServerRequestInterface $request): ResponseInterface |
108 | 108 | { |
109 | 109 | $context = []; |
110 | 110 | $param = new RequestData($request); |
111 | 111 | $totalItems = $this->permissionRepository->query() |
112 | - ->count('id'); |
|
112 | + ->count('id'); |
|
113 | 113 | |
114 | 114 | $currentPage = (int) $param->get('page', 1); |
115 | 115 | |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
140 | - * List entity detail |
|
141 | - * @param ServerRequestInterface $request |
|
142 | - * @return ResponseInterface |
|
143 | - */ |
|
140 | + * List entity detail |
|
141 | + * @param ServerRequestInterface $request |
|
142 | + * @return ResponseInterface |
|
143 | + */ |
|
144 | 144 | public function detail(ServerRequestInterface $request): ResponseInterface |
145 | 145 | { |
146 | 146 | $context = []; |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
169 | - * Create new entity |
|
170 | - * @param ServerRequestInterface $request |
|
171 | - * @return ResponseInterface |
|
172 | - */ |
|
169 | + * Create new entity |
|
170 | + * @param ServerRequestInterface $request |
|
171 | + * @return ResponseInterface |
|
172 | + */ |
|
173 | 173 | public function create(ServerRequestInterface $request): ResponseInterface |
174 | 174 | { |
175 | 175 | $context = []; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $context['param'] = $formParam; |
180 | 180 | |
181 | 181 | $permissions = $this->permissionRepository->orderBy('code') |
182 | - ->all(); |
|
182 | + ->all(); |
|
183 | 183 | |
184 | 184 | $context['permissions'] = $permissions; |
185 | 185 | |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | $entityExist = $this->permissionRepository->findBy([ |
206 | - 'code' => $formParam->getCode(), |
|
207 | - ]); |
|
206 | + 'code' => $formParam->getCode(), |
|
207 | + ]); |
|
208 | 208 | |
209 | 209 | if ($entityExist !== null) { |
210 | 210 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | /** @var Permission $permission */ |
220 | 220 | $permission = $this->permissionRepository->create([ |
221 | - 'code' => $formParam->getCode(), |
|
221 | + 'code' => $formParam->getCode(), |
|
222 | 222 | 'description' => $formParam->getDescription(), |
223 | 223 | 'depend' => $formParam->getDepend(), |
224 | 224 | ]); |
@@ -245,10 +245,10 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
248 | - * Update existing entity |
|
249 | - * @param ServerRequestInterface $request |
|
250 | - * @return ResponseInterface |
|
251 | - */ |
|
248 | + * Update existing entity |
|
249 | + * @param ServerRequestInterface $request |
|
250 | + * @return ResponseInterface |
|
251 | + */ |
|
252 | 252 | public function update(ServerRequestInterface $request): ResponseInterface |
253 | 253 | { |
254 | 254 | $context = []; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $context['param'] = (new PermissionParam())->fromEntity($permission); |
271 | 271 | |
272 | 272 | $permissions = $this->permissionRepository->orderBy('code') |
273 | - ->all(); |
|
273 | + ->all(); |
|
274 | 274 | |
275 | 275 | $context['permissions'] = $permissions; |
276 | 276 | |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | } |
297 | 297 | |
298 | 298 | $entityExist = $this->permissionRepository->findBy([ |
299 | - 'code' => $formParam->getCode(), |
|
300 | - ]); |
|
299 | + 'code' => $formParam->getCode(), |
|
300 | + ]); |
|
301 | 301 | |
302 | 302 | if ($entityExist !== null && $entityExist->id !== $id) { |
303 | 303 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
338 | - * Delete the entity |
|
339 | - * @param ServerRequestInterface $request |
|
340 | - * @return ResponseInterface |
|
341 | - */ |
|
338 | + * Delete the entity |
|
339 | + * @param ServerRequestInterface $request |
|
340 | + * @return ResponseInterface |
|
341 | + */ |
|
342 | 342 | public function delete(ServerRequestInterface $request): ResponseInterface |
343 | 343 | { |
344 | 344 | $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 | * The Lang instance |
32 | 31 | * @var Lang |
@@ -57,8 +57,7 @@ discard block |
||
57 | 57 | * @class HomeAction |
58 | 58 | * @package Platine\App\Http\Action |
59 | 59 | */ |
60 | -class HomeAction implements RequestHandlerInterface |
|
61 | -{ |
|
60 | +class HomeAction implements RequestHandlerInterface { |
|
62 | 61 | /** |
63 | 62 | * The template instance |
64 | 63 | * @var Template |
@@ -69,8 +68,7 @@ discard block |
||
69 | 68 | * Create new instance |
70 | 69 | * @param Template $template |
71 | 70 | */ |
72 | - public function __construct(Template $template) |
|
73 | - { |
|
71 | + public function __construct(Template $template) { |
|
74 | 72 | $this->template = $template; |
75 | 73 | } |
76 | 74 |
@@ -27,52 +27,52 @@ discard block |
||
27 | 27 | class AuthAction implements RequestHandlerInterface |
28 | 28 | { |
29 | 29 | /** |
30 | - * The AuthenticationInterface instance |
|
31 | - * @var AuthenticationInterface |
|
32 | - */ |
|
30 | + * The AuthenticationInterface instance |
|
31 | + * @var AuthenticationInterface |
|
32 | + */ |
|
33 | 33 | protected AuthenticationInterface $authentication; |
34 | 34 | |
35 | 35 | /** |
36 | - * The Flash instance |
|
37 | - * @var Flash |
|
38 | - */ |
|
36 | + * The Flash instance |
|
37 | + * @var Flash |
|
38 | + */ |
|
39 | 39 | protected Flash $flash; |
40 | 40 | |
41 | 41 | /** |
42 | - * The RouteHelper instance |
|
43 | - * @var RouteHelper |
|
44 | - */ |
|
42 | + * The RouteHelper instance |
|
43 | + * @var RouteHelper |
|
44 | + */ |
|
45 | 45 | protected RouteHelper $routeHelper; |
46 | 46 | |
47 | 47 | /** |
48 | - * The Lang instance |
|
49 | - * @var Lang |
|
50 | - */ |
|
48 | + * The Lang instance |
|
49 | + * @var Lang |
|
50 | + */ |
|
51 | 51 | protected Lang $lang; |
52 | 52 | |
53 | 53 | /** |
54 | - * The LoggerInterface instance |
|
55 | - * @var LoggerInterface |
|
56 | - */ |
|
54 | + * The LoggerInterface instance |
|
55 | + * @var LoggerInterface |
|
56 | + */ |
|
57 | 57 | protected LoggerInterface $logger; |
58 | 58 | |
59 | 59 | /** |
60 | - * The Template instance |
|
61 | - * @var Template |
|
62 | - */ |
|
60 | + * The Template instance |
|
61 | + * @var Template |
|
62 | + */ |
|
63 | 63 | protected Template $template; |
64 | 64 | |
65 | 65 | |
66 | 66 | |
67 | 67 | /** |
68 | - * Create new instance |
|
69 | - * @param AuthenticationInterface $authentication |
|
70 | - * @param Flash $flash |
|
71 | - * @param RouteHelper $routeHelper |
|
72 | - * @param Lang $lang |
|
73 | - * @param LoggerInterface $logger |
|
74 | - * @param Template $template |
|
75 | - */ |
|
68 | + * Create new instance |
|
69 | + * @param AuthenticationInterface $authentication |
|
70 | + * @param Flash $flash |
|
71 | + * @param RouteHelper $routeHelper |
|
72 | + * @param Lang $lang |
|
73 | + * @param LoggerInterface $logger |
|
74 | + * @param Template $template |
|
75 | + */ |
|
76 | 76 | public function __construct( |
77 | 77 | AuthenticationInterface $authentication, |
78 | 78 | Flash $flash, |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | - * {@inheritdoc} |
|
94 | - */ |
|
93 | + * {@inheritdoc} |
|
94 | + */ |
|
95 | 95 | public function handle(ServerRequestInterface $request): ResponseInterface |
96 | 96 | { |
97 | 97 | $context = []; |
@@ -24,8 +24,7 @@ |
||
24 | 24 | * @class AuthAction |
25 | 25 | * @package Platine\App\Http\Action\User |
26 | 26 | */ |
27 | -class AuthAction implements RequestHandlerInterface |
|
28 | -{ |
|
27 | +class AuthAction implements RequestHandlerInterface { |
|
29 | 28 | /** |
30 | 29 | * The AuthenticationInterface instance |
31 | 30 | * @var AuthenticationInterface |