@@ -30,71 +30,71 @@ discard block |
||
| 30 | 30 | class UserProfileAction |
| 31 | 31 | { |
| 32 | 32 | /** |
| 33 | - * The Lang instance |
|
| 34 | - * @var Lang |
|
| 35 | - */ |
|
| 33 | + * The Lang instance |
|
| 34 | + * @var Lang |
|
| 35 | + */ |
|
| 36 | 36 | protected Lang $lang; |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * The Template instance |
|
| 40 | - * @var Template |
|
| 41 | - */ |
|
| 39 | + * The Template instance |
|
| 40 | + * @var Template |
|
| 41 | + */ |
|
| 42 | 42 | protected Template $template; |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * The Flash instance |
|
| 46 | - * @var Flash |
|
| 47 | - */ |
|
| 45 | + * The Flash instance |
|
| 46 | + * @var Flash |
|
| 47 | + */ |
|
| 48 | 48 | protected Flash $flash; |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * The RouteHelper instance |
|
| 52 | - * @var RouteHelper |
|
| 53 | - */ |
|
| 51 | + * The RouteHelper instance |
|
| 52 | + * @var RouteHelper |
|
| 53 | + */ |
|
| 54 | 54 | protected RouteHelper $routeHelper; |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * The LoggerInterface instance |
|
| 58 | - * @var LoggerInterface |
|
| 59 | - */ |
|
| 57 | + * The LoggerInterface instance |
|
| 58 | + * @var LoggerInterface |
|
| 59 | + */ |
|
| 60 | 60 | protected LoggerInterface $logger; |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * The StatusList instance |
|
| 64 | - * @var StatusList |
|
| 65 | - */ |
|
| 63 | + * The StatusList instance |
|
| 64 | + * @var StatusList |
|
| 65 | + */ |
|
| 66 | 66 | protected StatusList $statusList; |
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | - * The HashInterface instance |
|
| 70 | - * @var HashInterface |
|
| 71 | - */ |
|
| 69 | + * The HashInterface instance |
|
| 70 | + * @var HashInterface |
|
| 71 | + */ |
|
| 72 | 72 | protected HashInterface $hash; |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | - * The UserRepository instance |
|
| 76 | - * @var UserRepository |
|
| 77 | - */ |
|
| 75 | + * The UserRepository instance |
|
| 76 | + * @var UserRepository |
|
| 77 | + */ |
|
| 78 | 78 | protected UserRepository $userRepository; |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * The AuthenticationInterface instance |
|
| 82 | - * @var AuthenticationInterface |
|
| 83 | - */ |
|
| 81 | + * The AuthenticationInterface instance |
|
| 82 | + * @var AuthenticationInterface |
|
| 83 | + */ |
|
| 84 | 84 | protected AuthenticationInterface $authentication; |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | - * Create new instance |
|
| 88 | - * @param Lang $lang |
|
| 89 | - * @param AuthenticationInterface $authentication |
|
| 90 | - * @param Template $template |
|
| 91 | - * @param Flash $flash |
|
| 92 | - * @param RouteHelper $routeHelper |
|
| 93 | - * @param LoggerInterface $logger |
|
| 94 | - * @param StatusList $statusList |
|
| 95 | - * @param HashInterface $hash |
|
| 96 | - * @param UserRepository $userRepository |
|
| 97 | - */ |
|
| 87 | + * Create new instance |
|
| 88 | + * @param Lang $lang |
|
| 89 | + * @param AuthenticationInterface $authentication |
|
| 90 | + * @param Template $template |
|
| 91 | + * @param Flash $flash |
|
| 92 | + * @param RouteHelper $routeHelper |
|
| 93 | + * @param LoggerInterface $logger |
|
| 94 | + * @param StatusList $statusList |
|
| 95 | + * @param HashInterface $hash |
|
| 96 | + * @param UserRepository $userRepository |
|
| 97 | + */ |
|
| 98 | 98 | public function __construct( |
| 99 | 99 | Lang $lang, |
| 100 | 100 | AuthenticationInterface $authentication, |
@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | - * User profile |
|
| 122 | - * @param ServerRequestInterface $request |
|
| 123 | - * @return ResponseInterface |
|
| 124 | - */ |
|
| 121 | + * User profile |
|
| 122 | + * @param ServerRequestInterface $request |
|
| 123 | + * @return ResponseInterface |
|
| 124 | + */ |
|
| 125 | 125 | public function detail(ServerRequestInterface $request): ResponseInterface |
| 126 | 126 | { |
| 127 | 127 | $context = []; |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | - * Update user profile |
|
| 155 | - * @param ServerRequestInterface $request |
|
| 156 | - * @return ResponseInterface |
|
| 157 | - */ |
|
| 154 | + * Update user profile |
|
| 155 | + * @param ServerRequestInterface $request |
|
| 156 | + * @return ResponseInterface |
|
| 157 | + */ |
|
| 158 | 158 | public function update(ServerRequestInterface $request): ResponseInterface |
| 159 | 159 | { |
| 160 | 160 | $context = []; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $user = $this->userRepository->find($id); |
| 167 | 167 | |
| 168 | 168 | if ($user === null) { |
| 169 | - $this->authentication->logout(); |
|
| 169 | + $this->authentication->logout(); |
|
| 170 | 170 | |
| 171 | 171 | $this->flash->setError($this->lang->tr('This record doesn\'t exist')); |
| 172 | 172 | |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | $usernameExist = $this->userRepository->findBy([ |
| 204 | - 'username' => $formParam->getUsername(), |
|
| 205 | - ]); |
|
| 204 | + 'username' => $formParam->getUsername(), |
|
| 205 | + ]); |
|
| 206 | 206 | |
| 207 | 207 | if ($usernameExist !== null && $usernameExist->id !== $id) { |
| 208 | 208 | $this->flash->setError($this->lang->tr('This username already exist')); |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | $emailExist = $this->userRepository->findBy([ |
| 218 | - 'email' => $formParam->getEmail(), |
|
| 219 | - ]); |
|
| 218 | + 'email' => $formParam->getEmail(), |
|
| 219 | + ]); |
|
| 220 | 220 | |
| 221 | 221 | if ($emailExist !== null && $emailExist->id !== $id) { |
| 222 | 222 | $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 | * The Lang instance |
| 34 | 33 | * @var Lang |
@@ -43,12 +43,12 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | public function addRoutes(Router $router): void |
| 45 | 45 | { |
| 46 | - $router->group('/user', function (Router $router) { |
|
| 46 | + $router->group('/user', function(Router $router) { |
|
| 47 | 47 | $router->add('/login', AuthAction::class, ['GET', 'POST'], 'user_login'); |
| 48 | 48 | $router->get('/logout', LogoutAction::class, 'user_logout'); |
| 49 | 49 | $router->resource('', UserAction::class, 'user'); |
| 50 | 50 | |
| 51 | - $router->group('/profile', function (Router $router) { |
|
| 51 | + $router->group('/profile', function(Router $router) { |
|
| 52 | 52 | $router->get('', sprintf('%s@detail', UserProfileAction::class), 'user_profile'); |
| 53 | 53 | $router->add( |
| 54 | 54 | '/update', |