@@ -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 |
@@ -79,7 +79,7 @@ |
||
79 | 79 | */ |
80 | 80 | public function addRoutes(Router $router): void |
81 | 81 | { |
82 | - $router->group('/roles', function (Router $router) { |
|
82 | + $router->group('/roles', function(Router $router) { |
|
83 | 83 | $router->get('', ListAction::class, 'role_list'); |
84 | 84 | $router->get('/detail/{id:i}', DetailAction::class, 'role_detail'); |
85 | 85 | $router->post('/batch', BatchAction::class, 'role_batch'); |
@@ -59,8 +59,7 @@ |
||
59 | 59 | * @class RoleServiceProvider |
60 | 60 | * @package Platine\Framework |
61 | 61 | */ |
62 | -class RoleServiceProvider extends ServiceProvider |
|
63 | -{ |
|
62 | +class RoleServiceProvider extends ServiceProvider { |
|
64 | 63 | |
65 | 64 | /** |
66 | 65 | * {@inheritdoc} |
@@ -54,8 +54,7 @@ discard block |
||
54 | 54 | * @class RequestData |
55 | 55 | * @package Platine\Framework\Http |
56 | 56 | */ |
57 | -class RequestData |
|
58 | -{ |
|
57 | +class RequestData { |
|
59 | 58 | |
60 | 59 | /** |
61 | 60 | * The request body or post data |
@@ -91,8 +90,7 @@ discard block |
||
91 | 90 | * Create new instance |
92 | 91 | * @param ServerRequestInterface $request |
93 | 92 | */ |
94 | - public function __construct(ServerRequestInterface $request) |
|
95 | - { |
|
93 | + public function __construct(ServerRequestInterface $request) { |
|
96 | 94 | $this->posts = (array) $request->getParsedBody(); |
97 | 95 | $this->gets = $request->getQueryParams(); |
98 | 96 | $this->servers = $request->getServerParams(); |
@@ -154,8 +152,7 @@ discard block |
||
154 | 152 | * |
155 | 153 | * @return mixed |
156 | 154 | */ |
157 | - public function get(string $key, $default = null) |
|
158 | - { |
|
155 | + public function get(string $key, $default = null) { |
|
159 | 156 | $gets = $this->applyInputClean($this->gets); |
160 | 157 | return Arr::get($gets, $key, $default); |
161 | 158 | } |
@@ -167,8 +164,7 @@ discard block |
||
167 | 164 | * |
168 | 165 | * @return mixed |
169 | 166 | */ |
170 | - public function post(string $key, $default = null) |
|
171 | - { |
|
167 | + public function post(string $key, $default = null) { |
|
172 | 168 | $posts = $this->applyInputClean($this->posts); |
173 | 169 | return Arr::get($posts, $key, $default); |
174 | 170 | } |
@@ -180,8 +176,7 @@ discard block |
||
180 | 176 | * |
181 | 177 | * @return mixed |
182 | 178 | */ |
183 | - public function server(string $key, $default = null) |
|
184 | - { |
|
179 | + public function server(string $key, $default = null) { |
|
185 | 180 | $servers = $this->applyInputClean($this->servers); |
186 | 181 | return Arr::get($servers, $key, $default); |
187 | 182 | } |
@@ -193,8 +188,7 @@ discard block |
||
193 | 188 | * |
194 | 189 | * @return mixed |
195 | 190 | */ |
196 | - public function cookie(string $key, $default = null) |
|
197 | - { |
|
191 | + public function cookie(string $key, $default = null) { |
|
198 | 192 | $cookies = $this->applyInputClean($this->cookies); |
199 | 193 | return Arr::get($cookies, $key, $default); |
200 | 194 | } |
@@ -204,8 +198,7 @@ discard block |
||
204 | 198 | * @param mixed $str |
205 | 199 | * @return mixed |
206 | 200 | */ |
207 | - protected function cleanInput($str) |
|
208 | - { |
|
201 | + protected function cleanInput($str) { |
|
209 | 202 | if (is_array($str)) { |
210 | 203 | return array_map([$this, 'cleanInput'], $str); |
211 | 204 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | public function handle(ServerRequestInterface $request): ResponseInterface |
133 | 133 | { |
134 | 134 | $permissions = $this->permissionRepository |
135 | - ->orderBy('code') |
|
136 | - ->all(); |
|
135 | + ->orderBy('code') |
|
136 | + ->all(); |
|
137 | 137 | |
138 | 138 | if ($request->getMethod() === 'GET') { |
139 | 139 | return new TemplateResponse( |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | $this->template, |
173 | 173 | 'permission/create', |
174 | 174 | [ |
175 | - 'param' => $formParam, |
|
176 | - 'permissions' => $permissions |
|
175 | + 'param' => $formParam, |
|
176 | + 'permissions' => $permissions |
|
177 | 177 | ] |
178 | 178 | ); |
179 | 179 | } |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | $this->template, |
195 | 195 | 'permission/create', |
196 | 196 | [ |
197 | - 'param' => $formParam, |
|
198 | - 'permissions' => $permissions |
|
197 | + 'param' => $formParam, |
|
198 | + 'permissions' => $permissions |
|
199 | 199 | ] |
200 | 200 | ); |
201 | 201 | } |
@@ -68,8 +68,7 @@ |
||
68 | 68 | * @package Platine\Framework\Demo\Action\Permission |
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 |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | $permissions = $this->permissionRepository |
145 | - ->orderBy('code') |
|
146 | - ->all(); |
|
145 | + ->orderBy('code') |
|
146 | + ->all(); |
|
147 | 147 | |
148 | 148 | |
149 | 149 | $entityToFormParam = (new PermissionParam())->fromEntity($permission); |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | $this->template, |
186 | 186 | 'permission/edit', |
187 | 187 | [ |
188 | - 'param' => $formParam, |
|
189 | - 'permissions' => $permissions |
|
188 | + 'param' => $formParam, |
|
189 | + 'permissions' => $permissions |
|
190 | 190 | ] |
191 | 191 | ); |
192 | 192 | } |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | $this->template, |
205 | 205 | 'permission/edit', |
206 | 206 | [ |
207 | - 'param' => $formParam, |
|
208 | - 'permissions' => $permissions |
|
207 | + 'param' => $formParam, |
|
208 | + 'permissions' => $permissions |
|
209 | 209 | ] |
210 | 210 | ); |
211 | 211 | } |
@@ -68,8 +68,7 @@ |
||
68 | 68 | * @package Platine\Framework\Demo\Action\Permission |
69 | 69 | * @template T |
70 | 70 | */ |
71 | -class EditAction implements RequestHandlerInterface |
|
72 | -{ |
|
71 | +class EditAction implements RequestHandlerInterface { |
|
73 | 72 | |
74 | 73 | /** |
75 | 74 | * The logger instance |
@@ -59,8 +59,7 @@ |
||
59 | 59 | * @package Platine\Framework\Demo\Action\Permission |
60 | 60 | * @template T |
61 | 61 | */ |
62 | -class ListAction implements RequestHandlerInterface |
|
63 | -{ |
|
62 | +class ListAction implements RequestHandlerInterface { |
|
64 | 63 | /** |
65 | 64 | * The permission repository |
66 | 65 | * @var PermissionRepository |
@@ -107,17 +107,17 @@ |
||
107 | 107 | |
108 | 108 | ////////// BEGIN PAGINATION ////////////////// |
109 | 109 | $totalItems = $this->permissionRepository->query() |
110 | - ->count('id'); |
|
110 | + ->count('id'); |
|
111 | 111 | $currentPage = (int)$param->get('page', 1); |
112 | 112 | $this->pagination->setTotalItems($totalItems) |
113 | - ->setCurrentPage($currentPage); |
|
113 | + ->setCurrentPage($currentPage); |
|
114 | 114 | $limit = $this->pagination->getItemsPerPage(); |
115 | 115 | $offset = $this->pagination->getOffset(); |
116 | 116 | ////////// END PAGINATION ////////////////// |
117 | 117 | |
118 | 118 | $permissions = $this->permissionRepository->limit($offset, $limit) |
119 | - ->orderBy('code') |
|
120 | - ->all(); |
|
119 | + ->orderBy('code') |
|
120 | + ->all(); |
|
121 | 121 | return new TemplateResponse( |
122 | 122 | $this->template, |
123 | 123 | 'permission/list', |
@@ -108,7 +108,7 @@ |
||
108 | 108 | ////////// BEGIN PAGINATION ////////////////// |
109 | 109 | $totalItems = $this->permissionRepository->query() |
110 | 110 | ->count('id'); |
111 | - $currentPage = (int)$param->get('page', 1); |
|
111 | + $currentPage = (int) $param->get('page', 1); |
|
112 | 112 | $this->pagination->setTotalItems($totalItems) |
113 | 113 | ->setCurrentPage($currentPage); |
114 | 114 | $limit = $this->pagination->getItemsPerPage(); |
@@ -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('permission_list') |
@@ -63,8 +63,7 @@ discard block |
||
63 | 63 | * @package Platine\Framework\Demo\Action\Permission |
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 permissions #{items}', ['items' => $items]); |
180 | 178 |