@@ -20,16 +20,16 @@ discard block |
||
| 20 | 20 | class AuthValidator extends AbstractValidator |
| 21 | 21 | { |
| 22 | 22 | /** |
| 23 | - * The parameter instance |
|
| 24 | - * @var AuthParam<TEntity> |
|
| 25 | - */ |
|
| 23 | + * The parameter instance |
|
| 24 | + * @var AuthParam<TEntity> |
|
| 25 | + */ |
|
| 26 | 26 | protected AuthParam $param; |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * Create new instance |
|
| 30 | - * @param AuthParam<TEntity> $param |
|
| 31 | - * @param Lang $lang |
|
| 32 | - */ |
|
| 29 | + * Create new instance |
|
| 30 | + * @param AuthParam<TEntity> $param |
|
| 31 | + * @param Lang $lang |
|
| 32 | + */ |
|
| 33 | 33 | public function __construct(AuthParam $param, Lang $lang) |
| 34 | 34 | { |
| 35 | 35 | parent::__construct($lang); |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * {@inheritdoc} |
|
| 41 | - */ |
|
| 40 | + * {@inheritdoc} |
|
| 41 | + */ |
|
| 42 | 42 | public function setValidationData(): void |
| 43 | 43 | { |
| 44 | 44 | $this->addData('username', $this->param->getUsername()); |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * {@inheritdoc} |
|
| 50 | - */ |
|
| 49 | + * {@inheritdoc} |
|
| 50 | + */ |
|
| 51 | 51 | public function setValidationRules(): void |
| 52 | 52 | { |
| 53 | 53 | $this->addRules('username', [ |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | class UserServiceProvider extends ServiceProvider |
| 19 | 19 | { |
| 20 | 20 | /** |
| 21 | - * {@inheritdoc} |
|
| 22 | - */ |
|
| 21 | + * {@inheritdoc} |
|
| 22 | + */ |
|
| 23 | 23 | public function register(): void |
| 24 | 24 | { |
| 25 | 25 | // User |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * {@inheritdoc} |
|
| 39 | - */ |
|
| 38 | + * {@inheritdoc} |
|
| 39 | + */ |
|
| 40 | 40 | public function addRoutes(Router $router): void |
| 41 | 41 | { |
| 42 | 42 | $router->group('/user', function (Router $router) { |
@@ -15,64 +15,64 @@ discard block |
||
| 15 | 15 | class UserParam extends BaseParam |
| 16 | 16 | { |
| 17 | 17 | /** |
| 18 | - * The username field |
|
| 19 | - * @var string |
|
| 20 | - */ |
|
| 18 | + * The username field |
|
| 19 | + * @var string |
|
| 20 | + */ |
|
| 21 | 21 | protected string $username; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * The lastname field |
|
| 25 | - * @var string |
|
| 26 | - */ |
|
| 24 | + * The lastname field |
|
| 25 | + * @var string |
|
| 26 | + */ |
|
| 27 | 27 | protected string $lastname; |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | - * The firstname field |
|
| 31 | - * @var string |
|
| 32 | - */ |
|
| 30 | + * The firstname field |
|
| 31 | + * @var string |
|
| 32 | + */ |
|
| 33 | 33 | protected string $firstname; |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * The email field |
|
| 37 | - * @var string |
|
| 38 | - */ |
|
| 36 | + * The email field |
|
| 37 | + * @var string |
|
| 38 | + */ |
|
| 39 | 39 | protected string $email; |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | - * The password field |
|
| 43 | - * @var string |
|
| 44 | - */ |
|
| 42 | + * The password field |
|
| 43 | + * @var string |
|
| 44 | + */ |
|
| 45 | 45 | protected string $password; |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * The password confirm field |
|
| 49 | - * @var string |
|
| 50 | - */ |
|
| 48 | + * The password confirm field |
|
| 49 | + * @var string |
|
| 50 | + */ |
|
| 51 | 51 | protected string $passwordConfirm; |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | - * The status field |
|
| 55 | - * @var string |
|
| 56 | - */ |
|
| 54 | + * The status field |
|
| 55 | + * @var string |
|
| 56 | + */ |
|
| 57 | 57 | protected string $status; |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * The role field |
|
| 61 | - * @var string|null |
|
| 62 | - */ |
|
| 60 | + * The role field |
|
| 61 | + * @var string|null |
|
| 62 | + */ |
|
| 63 | 63 | protected ?string $role = null; |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * The roles field |
|
| 67 | - * @var array<int> |
|
| 68 | - */ |
|
| 66 | + * The roles field |
|
| 67 | + * @var array<int> |
|
| 68 | + */ |
|
| 69 | 69 | protected array $roles = []; |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | - * @param TEntity $entity |
|
| 74 | - * @return $this |
|
| 75 | - */ |
|
| 73 | + * @param TEntity $entity |
|
| 74 | + * @return $this |
|
| 75 | + */ |
|
| 76 | 76 | public function fromEntity(Entity $entity): self |
| 77 | 77 | { |
| 78 | 78 | $this->username = $entity->username; |
@@ -87,81 +87,81 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | - * Return the username value |
|
| 91 | - * @return string |
|
| 92 | - */ |
|
| 90 | + * Return the username value |
|
| 91 | + * @return string |
|
| 92 | + */ |
|
| 93 | 93 | public function getUsername(): string |
| 94 | 94 | { |
| 95 | 95 | return $this->username; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Return the lastname value |
|
| 100 | - * @return string |
|
| 101 | - */ |
|
| 98 | + /** |
|
| 99 | + * Return the lastname value |
|
| 100 | + * @return string |
|
| 101 | + */ |
|
| 102 | 102 | public function getLastname(): string |
| 103 | 103 | { |
| 104 | 104 | return $this->lastname; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Return the firstname value |
|
| 109 | - * @return string |
|
| 110 | - */ |
|
| 107 | + /** |
|
| 108 | + * Return the firstname value |
|
| 109 | + * @return string |
|
| 110 | + */ |
|
| 111 | 111 | public function getFirstname(): string |
| 112 | 112 | { |
| 113 | 113 | return $this->firstname; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * Return the email value |
|
| 118 | - * @return string |
|
| 119 | - */ |
|
| 116 | + /** |
|
| 117 | + * Return the email value |
|
| 118 | + * @return string |
|
| 119 | + */ |
|
| 120 | 120 | public function getEmail(): string |
| 121 | 121 | { |
| 122 | 122 | return $this->email; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - /** |
|
| 126 | - * Return the password value |
|
| 127 | - * @return string |
|
| 128 | - */ |
|
| 125 | + /** |
|
| 126 | + * Return the password value |
|
| 127 | + * @return string |
|
| 128 | + */ |
|
| 129 | 129 | public function getPassword(): string |
| 130 | 130 | { |
| 131 | 131 | return $this->password; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - /** |
|
| 135 | - * Return the password confirm value |
|
| 136 | - * @return string |
|
| 137 | - */ |
|
| 134 | + /** |
|
| 135 | + * Return the password confirm value |
|
| 136 | + * @return string |
|
| 137 | + */ |
|
| 138 | 138 | public function getPasswordConfirm(): string |
| 139 | 139 | { |
| 140 | 140 | return $this->passwordConfirm; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - /** |
|
| 144 | - * Return the status value |
|
| 145 | - * @return string |
|
| 146 | - */ |
|
| 143 | + /** |
|
| 144 | + * Return the status value |
|
| 145 | + * @return string |
|
| 146 | + */ |
|
| 147 | 147 | public function getStatus(): string |
| 148 | 148 | { |
| 149 | 149 | return $this->status; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - /** |
|
| 153 | - * Return the role value |
|
| 154 | - * @return string|null |
|
| 155 | - */ |
|
| 152 | + /** |
|
| 153 | + * Return the role value |
|
| 154 | + * @return string|null |
|
| 155 | + */ |
|
| 156 | 156 | public function getRole(): ?string |
| 157 | 157 | { |
| 158 | 158 | return $this->role; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - /** |
|
| 162 | - * Return the roles |
|
| 163 | - * @return array<int> |
|
| 164 | - */ |
|
| 161 | + /** |
|
| 162 | + * Return the roles |
|
| 163 | + * @return array<int> |
|
| 164 | + */ |
|
| 165 | 165 | public function getRoles(): array |
| 166 | 166 | { |
| 167 | 167 | return $this->roles; |
@@ -169,10 +169,10 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | - * Set the username value |
|
| 173 | - * @param string $username |
|
| 174 | - * @return $this |
|
| 175 | - */ |
|
| 172 | + * Set the username value |
|
| 173 | + * @param string $username |
|
| 174 | + * @return $this |
|
| 175 | + */ |
|
| 176 | 176 | public function setUsername(string $username): self |
| 177 | 177 | { |
| 178 | 178 | $this->username = $username; |
@@ -180,11 +180,11 @@ discard block |
||
| 180 | 180 | return $this; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - /** |
|
| 184 | - * Set the lastname value |
|
| 185 | - * @param string $lastname |
|
| 186 | - * @return $this |
|
| 187 | - */ |
|
| 183 | + /** |
|
| 184 | + * Set the lastname value |
|
| 185 | + * @param string $lastname |
|
| 186 | + * @return $this |
|
| 187 | + */ |
|
| 188 | 188 | public function setLastname(string $lastname): self |
| 189 | 189 | { |
| 190 | 190 | $this->lastname = $lastname; |
@@ -192,11 +192,11 @@ discard block |
||
| 192 | 192 | return $this; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - /** |
|
| 196 | - * Set the firstname value |
|
| 197 | - * @param string $firstname |
|
| 198 | - * @return $this |
|
| 199 | - */ |
|
| 195 | + /** |
|
| 196 | + * Set the firstname value |
|
| 197 | + * @param string $firstname |
|
| 198 | + * @return $this |
|
| 199 | + */ |
|
| 200 | 200 | public function setFirstname(string $firstname): self |
| 201 | 201 | { |
| 202 | 202 | $this->firstname = $firstname; |
@@ -204,11 +204,11 @@ discard block |
||
| 204 | 204 | return $this; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - /** |
|
| 208 | - * Set the email value |
|
| 209 | - * @param string $email |
|
| 210 | - * @return $this |
|
| 211 | - */ |
|
| 207 | + /** |
|
| 208 | + * Set the email value |
|
| 209 | + * @param string $email |
|
| 210 | + * @return $this |
|
| 211 | + */ |
|
| 212 | 212 | public function setEmail(string $email): self |
| 213 | 213 | { |
| 214 | 214 | $this->email = $email; |
@@ -216,11 +216,11 @@ discard block |
||
| 216 | 216 | return $this; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - /** |
|
| 220 | - * Set the password value |
|
| 221 | - * @param string $password |
|
| 222 | - * @return $this |
|
| 223 | - */ |
|
| 219 | + /** |
|
| 220 | + * Set the password value |
|
| 221 | + * @param string $password |
|
| 222 | + * @return $this |
|
| 223 | + */ |
|
| 224 | 224 | public function setPassword(string $password): self |
| 225 | 225 | { |
| 226 | 226 | $this->password = $password; |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | return $this; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - /** |
|
| 232 | - * Set the password confirm value |
|
| 233 | - * @param string $passwordConfirm |
|
| 234 | - * @return $this |
|
| 235 | - */ |
|
| 231 | + /** |
|
| 232 | + * Set the password confirm value |
|
| 233 | + * @param string $passwordConfirm |
|
| 234 | + * @return $this |
|
| 235 | + */ |
|
| 236 | 236 | public function setPasswordConfirm(string $passwordConfirm): self |
| 237 | 237 | { |
| 238 | 238 | $this->passwordConfirm = $passwordConfirm; |
@@ -240,11 +240,11 @@ discard block |
||
| 240 | 240 | return $this; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - /** |
|
| 244 | - * Set the status value |
|
| 245 | - * @param string $status |
|
| 246 | - * @return $this |
|
| 247 | - */ |
|
| 243 | + /** |
|
| 244 | + * Set the status value |
|
| 245 | + * @param string $status |
|
| 246 | + * @return $this |
|
| 247 | + */ |
|
| 248 | 248 | public function setStatus(string $status): self |
| 249 | 249 | { |
| 250 | 250 | $this->status = $status; |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | return $this; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - /** |
|
| 256 | - * Set the role value |
|
| 257 | - * @param string|null $role |
|
| 258 | - * @return $this |
|
| 259 | - */ |
|
| 255 | + /** |
|
| 256 | + * Set the role value |
|
| 257 | + * @param string|null $role |
|
| 258 | + * @return $this |
|
| 259 | + */ |
|
| 260 | 260 | public function setRole(?string $role): self |
| 261 | 261 | { |
| 262 | 262 | $this->role = $role; |
@@ -264,11 +264,11 @@ discard block |
||
| 264 | 264 | return $this; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - /** |
|
| 268 | - * Set the roles |
|
| 269 | - * @param array<int> $roles |
|
| 270 | - * @return $this |
|
| 271 | - */ |
|
| 267 | + /** |
|
| 268 | + * Set the roles |
|
| 269 | + * @param array<int> $roles |
|
| 270 | + * @return $this |
|
| 271 | + */ |
|
| 272 | 272 | public function setRoles(array $roles): self |
| 273 | 273 | { |
| 274 | 274 | $this->roles = $roles; |
@@ -33,80 +33,80 @@ discard block |
||
| 33 | 33 | class UserAction |
| 34 | 34 | { |
| 35 | 35 | /** |
| 36 | - * The Lang instance |
|
| 37 | - * @var Lang |
|
| 38 | - */ |
|
| 36 | + * The Lang instance |
|
| 37 | + * @var Lang |
|
| 38 | + */ |
|
| 39 | 39 | protected Lang $lang; |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | - * The Pagination instance |
|
| 43 | - * @var Pagination |
|
| 44 | - */ |
|
| 42 | + * The Pagination instance |
|
| 43 | + * @var Pagination |
|
| 44 | + */ |
|
| 45 | 45 | protected Pagination $pagination; |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * The Template instance |
|
| 49 | - * @var Template |
|
| 50 | - */ |
|
| 48 | + * The Template instance |
|
| 49 | + * @var Template |
|
| 50 | + */ |
|
| 51 | 51 | protected Template $template; |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | - * The Flash instance |
|
| 55 | - * @var Flash |
|
| 56 | - */ |
|
| 54 | + * The Flash instance |
|
| 55 | + * @var Flash |
|
| 56 | + */ |
|
| 57 | 57 | protected Flash $flash; |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * The RouteHelper instance |
|
| 61 | - * @var RouteHelper |
|
| 62 | - */ |
|
| 60 | + * The RouteHelper instance |
|
| 61 | + * @var RouteHelper |
|
| 62 | + */ |
|
| 63 | 63 | protected RouteHelper $routeHelper; |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * The LoggerInterface instance |
|
| 67 | - * @var LoggerInterface |
|
| 68 | - */ |
|
| 66 | + * The LoggerInterface instance |
|
| 67 | + * @var LoggerInterface |
|
| 68 | + */ |
|
| 69 | 69 | protected LoggerInterface $logger; |
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | - * The RoleRepository instance |
|
| 73 | - * @var RoleRepository |
|
| 74 | - */ |
|
| 72 | + * The RoleRepository instance |
|
| 73 | + * @var RoleRepository |
|
| 74 | + */ |
|
| 75 | 75 | protected RoleRepository $roleRepository; |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * The StatusList instance |
|
| 79 | - * @var StatusList |
|
| 80 | - */ |
|
| 78 | + * The StatusList instance |
|
| 79 | + * @var StatusList |
|
| 80 | + */ |
|
| 81 | 81 | protected StatusList $statusList; |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | - * The HashInterface instance |
|
| 85 | - * @var HashInterface |
|
| 86 | - */ |
|
| 84 | + * The HashInterface instance |
|
| 85 | + * @var HashInterface |
|
| 86 | + */ |
|
| 87 | 87 | protected HashInterface $hash; |
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | - * The UserRepository instance |
|
| 91 | - * @var UserRepository |
|
| 92 | - */ |
|
| 90 | + * The UserRepository instance |
|
| 91 | + * @var UserRepository |
|
| 92 | + */ |
|
| 93 | 93 | protected UserRepository $userRepository; |
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | - * Create new instance |
|
| 99 | - * @param Lang $lang |
|
| 100 | - * @param Pagination $pagination |
|
| 101 | - * @param Template $template |
|
| 102 | - * @param Flash $flash |
|
| 103 | - * @param RouteHelper $routeHelper |
|
| 104 | - * @param LoggerInterface $logger |
|
| 105 | - * @param RoleRepository $roleRepository |
|
| 106 | - * @param StatusList $statusList |
|
| 107 | - * @param HashInterface $hash |
|
| 108 | - * @param UserRepository $userRepository |
|
| 109 | - */ |
|
| 98 | + * Create new instance |
|
| 99 | + * @param Lang $lang |
|
| 100 | + * @param Pagination $pagination |
|
| 101 | + * @param Template $template |
|
| 102 | + * @param Flash $flash |
|
| 103 | + * @param RouteHelper $routeHelper |
|
| 104 | + * @param LoggerInterface $logger |
|
| 105 | + * @param RoleRepository $roleRepository |
|
| 106 | + * @param StatusList $statusList |
|
| 107 | + * @param HashInterface $hash |
|
| 108 | + * @param UserRepository $userRepository |
|
| 109 | + */ |
|
| 110 | 110 | public function __construct( |
| 111 | 111 | Lang $lang, |
| 112 | 112 | Pagination $pagination, |
@@ -132,16 +132,16 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | - * List all entities |
|
| 136 | - * @param ServerRequestInterface $request |
|
| 137 | - * @return ResponseInterface |
|
| 138 | - */ |
|
| 135 | + * List all entities |
|
| 136 | + * @param ServerRequestInterface $request |
|
| 137 | + * @return ResponseInterface |
|
| 138 | + */ |
|
| 139 | 139 | public function index(ServerRequestInterface $request): ResponseInterface |
| 140 | 140 | { |
| 141 | 141 | $context = []; |
| 142 | 142 | $param = new RequestData($request); |
| 143 | 143 | $totalItems = $this->userRepository->query() |
| 144 | - ->count('id'); |
|
| 144 | + ->count('id'); |
|
| 145 | 145 | |
| 146 | 146 | $currentPage = (int) $param->get('page', 1); |
| 147 | 147 | |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
| 174 | - * List entity detail |
|
| 175 | - * @param ServerRequestInterface $request |
|
| 176 | - * @return ResponseInterface |
|
| 177 | - */ |
|
| 174 | + * List entity detail |
|
| 175 | + * @param ServerRequestInterface $request |
|
| 176 | + * @return ResponseInterface |
|
| 177 | + */ |
|
| 178 | 178 | public function detail(ServerRequestInterface $request): ResponseInterface |
| 179 | 179 | { |
| 180 | 180 | $context = []; |
@@ -201,10 +201,10 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | - * Create new entity |
|
| 205 | - * @param ServerRequestInterface $request |
|
| 206 | - * @return ResponseInterface |
|
| 207 | - */ |
|
| 204 | + * Create new entity |
|
| 205 | + * @param ServerRequestInterface $request |
|
| 206 | + * @return ResponseInterface |
|
| 207 | + */ |
|
| 208 | 208 | public function create(ServerRequestInterface $request): ResponseInterface |
| 209 | 209 | { |
| 210 | 210 | $context = []; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $formParam = new UserParam($param->posts()); |
| 214 | 214 | $context['param'] = $formParam; |
| 215 | 215 | $context['roles'] = $this->roleRepository->orderBy('name') |
| 216 | - ->all(); |
|
| 216 | + ->all(); |
|
| 217 | 217 | |
| 218 | 218 | $context['user_status'] = $this->statusList->getUserStatus(); |
| 219 | 219 | |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | $usernameExist = $this->userRepository->findBy([ |
| 241 | - 'username' => $formParam->getUsername(), |
|
| 242 | - ]); |
|
| 241 | + 'username' => $formParam->getUsername(), |
|
| 242 | + ]); |
|
| 243 | 243 | |
| 244 | 244 | if ($usernameExist !== null) { |
| 245 | 245 | $this->flash->setError($this->lang->tr('This username already exist')); |
@@ -252,8 +252,8 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | $emailExist = $this->userRepository->findBy([ |
| 255 | - 'email' => $formParam->getEmail(), |
|
| 256 | - ]); |
|
| 255 | + 'email' => $formParam->getEmail(), |
|
| 256 | + ]); |
|
| 257 | 257 | |
| 258 | 258 | if ($emailExist !== null) { |
| 259 | 259 | $this->flash->setError($this->lang->tr('This email already exist')); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | /** @var User $user */ |
| 271 | 271 | $user = $this->userRepository->create([ |
| 272 | - 'username' => $formParam->getUsername(), |
|
| 272 | + 'username' => $formParam->getUsername(), |
|
| 273 | 273 | 'lastname' => Str::upper($formParam->getLastname()), |
| 274 | 274 | 'firstname' => Str::ucfirst($formParam->getFirstname()), |
| 275 | 275 | 'email' => $formParam->getEmail(), |
@@ -306,10 +306,10 @@ discard block |
||
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
| 309 | - * Update existing entity |
|
| 310 | - * @param ServerRequestInterface $request |
|
| 311 | - * @return ResponseInterface |
|
| 312 | - */ |
|
| 309 | + * Update existing entity |
|
| 310 | + * @param ServerRequestInterface $request |
|
| 311 | + * @return ResponseInterface |
|
| 312 | + */ |
|
| 313 | 313 | public function update(ServerRequestInterface $request): ResponseInterface |
| 314 | 314 | { |
| 315 | 315 | $context = []; |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $context['param']->setRoles($currentRolesId); |
| 334 | 334 | |
| 335 | 335 | $context['roles'] = $this->roleRepository->orderBy('name') |
| 336 | - ->all(); |
|
| 336 | + ->all(); |
|
| 337 | 337 | |
| 338 | 338 | $context['user_status'] = $this->statusList->getUserStatus(); |
| 339 | 339 | |
@@ -359,8 +359,8 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | $usernameExist = $this->userRepository->findBy([ |
| 362 | - 'username' => $formParam->getUsername(), |
|
| 363 | - ]); |
|
| 362 | + 'username' => $formParam->getUsername(), |
|
| 363 | + ]); |
|
| 364 | 364 | |
| 365 | 365 | if ($usernameExist !== null && $usernameExist->id !== $id) { |
| 366 | 366 | $this->flash->setError($this->lang->tr('This username already exist')); |
@@ -373,8 +373,8 @@ discard block |
||
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | $emailExist = $this->userRepository->findBy([ |
| 376 | - 'email' => $formParam->getEmail(), |
|
| 377 | - ]); |
|
| 376 | + 'email' => $formParam->getEmail(), |
|
| 377 | + ]); |
|
| 378 | 378 | |
| 379 | 379 | if ($emailExist !== null && $emailExist->id !== $id) { |
| 380 | 380 | $this->flash->setError($this->lang->tr('This email already exist')); |
@@ -435,10 +435,10 @@ discard block |
||
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | /** |
| 438 | - * Delete the entity |
|
| 439 | - * @param ServerRequestInterface $request |
|
| 440 | - * @return ResponseInterface |
|
| 441 | - */ |
|
| 438 | + * Delete the entity |
|
| 439 | + * @param ServerRequestInterface $request |
|
| 440 | + * @return ResponseInterface |
|
| 441 | + */ |
|
| 442 | 442 | public function delete(ServerRequestInterface $request): ResponseInterface |
| 443 | 443 | { |
| 444 | 444 | $id = (int) $request->getAttribute('id'); |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | class UserValidator extends AbstractValidator |
| 25 | 25 | { |
| 26 | 26 | /** |
| 27 | - * The parameter instance |
|
| 28 | - * @var UserParam<TEntity> |
|
| 29 | - */ |
|
| 27 | + * The parameter instance |
|
| 28 | + * @var UserParam<TEntity> |
|
| 29 | + */ |
|
| 30 | 30 | protected UserParam $param; |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | protected bool $ignorePassword; |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * Create new instance |
|
| 40 | - * @param UserParam<TEntity> $param |
|
| 41 | - * @param Lang $lang |
|
| 42 | - * @param bool $ignorePassword |
|
| 43 | - */ |
|
| 39 | + * Create new instance |
|
| 40 | + * @param UserParam<TEntity> $param |
|
| 41 | + * @param Lang $lang |
|
| 42 | + * @param bool $ignorePassword |
|
| 43 | + */ |
|
| 44 | 44 | public function __construct(UserParam $param, Lang $lang, bool $ignorePassword = false) |
| 45 | 45 | { |
| 46 | 46 | parent::__construct($lang); |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * {@inheritdoc} |
|
| 53 | - */ |
|
| 52 | + * {@inheritdoc} |
|
| 53 | + */ |
|
| 54 | 54 | public function setValidationData(): void |
| 55 | 55 | { |
| 56 | 56 | $this->addData('username', $this->param->getUsername()); |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * {@inheritdoc} |
|
| 68 | - */ |
|
| 67 | + * {@inheritdoc} |
|
| 68 | + */ |
|
| 69 | 69 | public function setValidationRules(): void |
| 70 | 70 | { |
| 71 | 71 | $this->addRules('username', [ |
@@ -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')); |