@@ -55,8 +55,7 @@ |
||
55 | 55 | * @class CurrentUrlTag |
56 | 56 | * @package Platine\Framework\Template\Tag |
57 | 57 | */ |
58 | -class CurrentUrlTag extends AbstractTag |
|
59 | -{ |
|
58 | +class CurrentUrlTag extends AbstractTag { |
|
60 | 59 | |
61 | 60 | /** |
62 | 61 | * {@inheritdoc} |
@@ -68,8 +68,7 @@ |
||
68 | 68 | * @package Platine\Framework\Demo\Action\Role |
69 | 69 | * @template T |
70 | 70 | */ |
71 | -class CreateAction implements RequestHandlerInterface |
|
72 | -{ |
|
71 | +class CreateAction implements RequestHandlerInterface { |
|
73 | 72 | |
74 | 73 | /** |
75 | 74 | * Logger instance |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | public function handle(ServerRequestInterface $request): ResponseInterface |
149 | 149 | { |
150 | 150 | $permissions = $this->permissionRepository |
151 | - ->orderBy('code') |
|
152 | - ->all(); |
|
151 | + ->orderBy('code') |
|
152 | + ->all(); |
|
153 | 153 | |
154 | 154 | if ($request->getMethod() === 'GET') { |
155 | 155 | return new TemplateResponse( |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | $this->template, |
189 | 189 | 'role/create', |
190 | 190 | [ |
191 | - 'param' => $formParam, |
|
192 | - 'permissions' => $permissions |
|
191 | + 'param' => $formParam, |
|
192 | + 'permissions' => $permissions |
|
193 | 193 | ] |
194 | 194 | ); |
195 | 195 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | 'description' => $formParam->getDescription() |
201 | 201 | ]); |
202 | 202 | |
203 | - //Handle permissions |
|
203 | + //Handle permissions |
|
204 | 204 | $permissionsId = $param->post('permissions', []); |
205 | 205 | if (!empty($permissionsId)) { |
206 | 206 | $selectedPermissions = $this->permissionRepository->findAll(...$permissionsId); |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | $this->template, |
218 | 218 | 'role/create', |
219 | 219 | [ |
220 | - 'param' => $formParam, |
|
221 | - 'permissions' => $permissions |
|
220 | + 'param' => $formParam, |
|
221 | + 'permissions' => $permissions |
|
222 | 222 | ] |
223 | 223 | ); |
224 | 224 | } |
@@ -59,8 +59,7 @@ |
||
59 | 59 | * @package Platine\Framework\Demo\Action\Role |
60 | 60 | * @template T |
61 | 61 | */ |
62 | -class ListAction implements RequestHandlerInterface |
|
63 | -{ |
|
62 | +class ListAction implements RequestHandlerInterface { |
|
64 | 63 | /** |
65 | 64 | * The role repository |
66 | 65 | * @var RoleRepository |
@@ -109,14 +109,14 @@ |
||
109 | 109 | ->count('id'); |
110 | 110 | $currentPage = (int)$param->get('page', 1); |
111 | 111 | $this->pagination->setTotalItems($totalItems) |
112 | - ->setCurrentPage($currentPage); |
|
112 | + ->setCurrentPage($currentPage); |
|
113 | 113 | $limit = $this->pagination->getItemsPerPage(); |
114 | 114 | $offset = $this->pagination->getOffset(); |
115 | 115 | ////////// END PAGINATION ////////////////// |
116 | 116 | |
117 | 117 | $roles = $this->roleRepository |
118 | - ->limit($offset, $limit) |
|
119 | - ->all(); |
|
118 | + ->limit($offset, $limit) |
|
119 | + ->all(); |
|
120 | 120 | |
121 | 121 | return new TemplateResponse( |
122 | 122 | $this->template, |
@@ -107,7 +107,7 @@ |
||
107 | 107 | ////////// BEGIN PAGINATION ////////////////// |
108 | 108 | $totalItems = $this->roleRepository->query() |
109 | 109 | ->count('id'); |
110 | - $currentPage = (int)$param->get('page', 1); |
|
110 | + $currentPage = (int) $param->get('page', 1); |
|
111 | 111 | $this->pagination->setTotalItems($totalItems) |
112 | 112 | ->setCurrentPage($currentPage); |
113 | 113 | $limit = $this->pagination->getItemsPerPage(); |
@@ -63,8 +63,7 @@ |
||
63 | 63 | * @package Platine\Framework\Demo\Action\Role |
64 | 64 | * @template T |
65 | 65 | */ |
66 | -class DetailAction implements RequestHandlerInterface |
|
67 | -{ |
|
66 | +class DetailAction implements RequestHandlerInterface { |
|
68 | 67 | |
69 | 68 | /** |
70 | 69 | * The logger instance |
@@ -135,8 +135,8 @@ |
||
135 | 135 | { |
136 | 136 | $id = (int) $request->getAttribute('id'); |
137 | 137 | $role = $this->roleRepository |
138 | - ->with('permissions') |
|
139 | - ->find($id); |
|
138 | + ->with('permissions') |
|
139 | + ->find($id); |
|
140 | 140 | if (!$role) { |
141 | 141 | $this->session->setFlash('error', $this->lang->tr('Can not find the role')); |
142 | 142 | $this->logger->warning('Can not find role with id {id}', ['id' => $id]); |
@@ -137,7 +137,7 @@ |
||
137 | 137 | { |
138 | 138 | $param = new RequestData($request); |
139 | 139 | |
140 | - $items = $param->post('items', []); |
|
140 | + $items = $param->post('items', []); |
|
141 | 141 | if (empty($items)) { |
142 | 142 | return new RedirectResponse( |
143 | 143 | $this->routeHelper->generateUrl('role_list') |
@@ -63,8 +63,7 @@ discard block |
||
63 | 63 | * @package Platine\Framework\Demo\Action\Role |
64 | 64 | * @template T |
65 | 65 | */ |
66 | -class BatchAction implements RequestHandlerInterface |
|
67 | -{ |
|
66 | +class BatchAction implements RequestHandlerInterface { |
|
68 | 67 | |
69 | 68 | /** |
70 | 69 | * Logger instance |
@@ -173,8 +172,7 @@ discard block |
||
173 | 172 | * Handle delete action |
174 | 173 | * @return mixed|void |
175 | 174 | */ |
176 | - protected function deleteHandle() |
|
177 | - { |
|
175 | + protected function deleteHandle() { |
|
178 | 176 | $items = $this->items; |
179 | 177 | $this->logger->info('Deleted of roles #{items}', ['items' => $items]); |
180 | 178 |
@@ -70,8 +70,7 @@ |
||
70 | 70 | * @package Platine\Framework\Demo\Action\Role |
71 | 71 | * @template T |
72 | 72 | */ |
73 | -class EditAction implements RequestHandlerInterface |
|
74 | -{ |
|
73 | +class EditAction implements RequestHandlerInterface { |
|
75 | 74 | |
76 | 75 | /** |
77 | 76 | * The logger instance |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | $permissions = $this->permissionRepository |
166 | - ->orderBy('code') |
|
167 | - ->all(); |
|
166 | + ->orderBy('code') |
|
167 | + ->all(); |
|
168 | 168 | |
169 | 169 | $currentPermissionsId = []; |
170 | 170 | foreach ($role->permissions as $entity) { |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | $this->template, |
212 | 212 | 'role/edit', |
213 | 213 | [ |
214 | - 'param' => $formParam, |
|
215 | - 'permissions' => $permissions |
|
214 | + 'param' => $formParam, |
|
215 | + 'permissions' => $permissions |
|
216 | 216 | ] |
217 | 217 | ); |
218 | 218 | } |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | $this->template, |
244 | 244 | 'role/edit', |
245 | 245 | [ |
246 | - 'param' => $formParam, |
|
247 | - 'permissions' => $permissions |
|
246 | + 'param' => $formParam, |
|
247 | + 'permissions' => $permissions |
|
248 | 248 | ] |
249 | 249 | ); |
250 | 250 | } |
@@ -54,8 +54,7 @@ |
||
54 | 54 | * @class RoleParam |
55 | 55 | * @package Platine\Framework\Demo\Form\Param |
56 | 56 | */ |
57 | -class RoleParam extends BaseParam |
|
58 | -{ |
|
57 | +class RoleParam extends BaseParam { |
|
59 | 58 | /** |
60 | 59 | * The name |
61 | 60 | * @var string |
@@ -92,12 +92,12 @@ |
||
92 | 92 | public function setRules(): void |
93 | 93 | { |
94 | 94 | $this->validator->addRules('name', [ |
95 | - new NotEmpty(), |
|
96 | - new MinLength(2) |
|
95 | + new NotEmpty(), |
|
96 | + new MinLength(2) |
|
97 | 97 | ]); |
98 | 98 | |
99 | 99 | $this->validator->addRules('description', [ |
100 | - new MinLength(3) |
|
100 | + new MinLength(3) |
|
101 | 101 | ]); |
102 | 102 | } |
103 | 103 | } |
@@ -57,8 +57,7 @@ discard block |
||
57 | 57 | * @class RoleValidator |
58 | 58 | * @package Platine\Framework\Demo\Form\Validator |
59 | 59 | */ |
60 | -class RoleValidator extends AbstractValidator |
|
61 | -{ |
|
60 | +class RoleValidator extends AbstractValidator { |
|
62 | 61 | |
63 | 62 | /** |
64 | 63 | * The parameter instance |
@@ -71,8 +70,7 @@ discard block |
||
71 | 70 | * @param RoleParam $param |
72 | 71 | * @param Validator|null $validator |
73 | 72 | */ |
74 | - public function __construct(RoleParam $param, ?Validator $validator = null) |
|
75 | - { |
|
73 | + public function __construct(RoleParam $param, ?Validator $validator = null) { |
|
76 | 74 | parent::__construct($validator); |
77 | 75 | $this->param = $param; |
78 | 76 | } |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | * @class UserValidator |
61 | 61 | * @package Platine\Framework\Demo\Form\Validator |
62 | 62 | */ |
63 | -class UserValidator extends AbstractValidator |
|
64 | -{ |
|
63 | +class UserValidator extends AbstractValidator { |
|
65 | 64 | |
66 | 65 | /** |
67 | 66 | * The parameter instance |
@@ -74,8 +73,7 @@ discard block |
||
74 | 73 | * @param UserParam $param |
75 | 74 | * @param Validator|null $validator |
76 | 75 | */ |
77 | - public function __construct(UserParam $param, ?Validator $validator = null) |
|
78 | - { |
|
76 | + public function __construct(UserParam $param, ?Validator $validator = null) { |
|
79 | 77 | parent::__construct($validator); |
80 | 78 | $this->param = $param; |
81 | 79 | } |
@@ -100,37 +100,37 @@ |
||
100 | 100 | public function setRules(): void |
101 | 101 | { |
102 | 102 | $this->validator->addRules('username', [ |
103 | - new NotEmpty(), |
|
104 | - new MinLength(3), |
|
105 | - new AlphaDash() |
|
103 | + new NotEmpty(), |
|
104 | + new MinLength(3), |
|
105 | + new AlphaDash() |
|
106 | 106 | ]); |
107 | 107 | |
108 | 108 | $this->validator->addRules('lastname', [ |
109 | - new NotEmpty(), |
|
110 | - new MinLength(3) |
|
109 | + new NotEmpty(), |
|
110 | + new MinLength(3) |
|
111 | 111 | ]); |
112 | 112 | |
113 | 113 | $this->validator->addRules('firstname', [ |
114 | - new NotEmpty(), |
|
115 | - new MinLength(3) |
|
114 | + new NotEmpty(), |
|
115 | + new MinLength(3) |
|
116 | 116 | ]); |
117 | 117 | |
118 | 118 | $this->validator->addRules('status', [ |
119 | - new NotEmpty(), |
|
120 | - new InList(['A', 'D']) |
|
119 | + new NotEmpty(), |
|
120 | + new InList(['A', 'D']) |
|
121 | 121 | ]); |
122 | 122 | |
123 | 123 | $this->validator->addRules('email', [ |
124 | - new NotEmpty(), |
|
125 | - new Email() |
|
124 | + new NotEmpty(), |
|
125 | + new Email() |
|
126 | 126 | ]); |
127 | 127 | |
128 | 128 | $this->validator->addRules('role', [ |
129 | - new MinLength(3) |
|
129 | + new MinLength(3) |
|
130 | 130 | ]); |
131 | 131 | |
132 | 132 | $this->validator->addRules('password', [ |
133 | - new MinLength(5), |
|
133 | + new MinLength(5), |
|
134 | 134 | ]); |
135 | 135 | } |
136 | 136 | } |