@@ -4,8 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Platine\Validator\Validator; |
| 6 | 6 | |
| 7 | -abstract class AbstractValidator |
|
| 8 | -{ |
|
| 7 | +abstract class AbstractValidator { |
|
| 9 | 8 | /** |
| 10 | 9 | * The validator instance |
| 11 | 10 | * @var Validator |
@@ -22,8 +21,7 @@ discard block |
||
| 22 | 21 | * Create new instance |
| 23 | 22 | * @param Validator|null $validator |
| 24 | 23 | */ |
| 25 | - public function __construct(?Validator $validator = null) |
|
| 26 | - { |
|
| 24 | + public function __construct(?Validator $validator = null) { |
|
| 27 | 25 | $this->validator = $validator ?? new Validator(); |
| 28 | 26 | } |
| 29 | 27 | |
@@ -7,8 +7,7 @@ discard block |
||
| 7 | 7 | use Platine\Validator\Rule\NotEmpty; |
| 8 | 8 | use Platine\Validator\Validator; |
| 9 | 9 | |
| 10 | -class AuthValidator extends AbstractValidator |
|
| 11 | -{ |
|
| 10 | +class AuthValidator extends AbstractValidator { |
|
| 12 | 11 | |
| 13 | 12 | protected AuthParam $param; |
| 14 | 13 | |
@@ -17,8 +16,7 @@ discard block |
||
| 17 | 16 | * @param AuthParam $param |
| 18 | 17 | * @param Validator|null $validator |
| 19 | 18 | */ |
| 20 | - public function __construct(AuthParam $param, ?Validator $validator = null) |
|
| 21 | - { |
|
| 19 | + public function __construct(AuthParam $param, ?Validator $validator = null) { |
|
| 22 | 20 | parent::__construct($validator); |
| 23 | 21 | $this->param = $param; |
| 24 | 22 | } |
@@ -32,12 +32,12 @@ |
||
| 32 | 32 | public function setRules(): void |
| 33 | 33 | { |
| 34 | 34 | $this->validator->addRules('username', [ |
| 35 | - new NotEmpty(), |
|
| 36 | - new MinLength(3) |
|
| 35 | + new NotEmpty(), |
|
| 36 | + new MinLength(3) |
|
| 37 | 37 | ]); |
| 38 | 38 | |
| 39 | 39 | $this->validator->addRules('password', [ |
| 40 | - new NotEmpty(), |
|
| 40 | + new NotEmpty(), |
|
| 41 | 41 | ]); |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -21,8 +21,7 @@ |
||
| 21 | 21 | * |
| 22 | 22 | * @author tony |
| 23 | 23 | */ |
| 24 | -class LoginAction implements RequestHandlerInterface |
|
| 25 | -{ |
|
| 24 | +class LoginAction implements RequestHandlerInterface { |
|
| 26 | 25 | |
| 27 | 26 | protected LoggerInterface $logger; |
| 28 | 27 | protected Session $session; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $this->template, |
| 83 | 83 | 'user/login', |
| 84 | 84 | [ |
| 85 | - 'param' => $formParam |
|
| 85 | + 'param' => $formParam |
|
| 86 | 86 | ] |
| 87 | 87 | ); |
| 88 | 88 | } |
@@ -95,16 +95,16 @@ discard block |
||
| 95 | 95 | $this->template, |
| 96 | 96 | 'user/login', |
| 97 | 97 | [ |
| 98 | - 'param' => $formParam |
|
| 98 | + 'param' => $formParam |
|
| 99 | 99 | ] |
| 100 | 100 | ); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $data = [ |
| 104 | - 'id' => $user->user_id, |
|
| 105 | - 'username' => $user->username, |
|
| 106 | - 'lastname' => $user->lname, |
|
| 107 | - 'firstname' => $user->fname, |
|
| 104 | + 'id' => $user->user_id, |
|
| 105 | + 'username' => $user->username, |
|
| 106 | + 'lastname' => $user->lname, |
|
| 107 | + 'firstname' => $user->fname, |
|
| 108 | 108 | ]; |
| 109 | 109 | $this->session->set('user', $data); |
| 110 | 110 | $this->session->set('permissions', ['users']); |
@@ -21,8 +21,7 @@ |
||
| 21 | 21 | * |
| 22 | 22 | * @author tony |
| 23 | 23 | */ |
| 24 | -class CreateAction implements RequestHandlerInterface |
|
| 25 | -{ |
|
| 24 | +class CreateAction implements RequestHandlerInterface { |
|
| 26 | 25 | |
| 27 | 26 | protected LoggerInterface $logger; |
| 28 | 27 | protected Session $session; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $this->template, |
| 80 | 80 | 'user/create', |
| 81 | 81 | [ |
| 82 | - 'param' => $formParam |
|
| 82 | + 'param' => $formParam |
|
| 83 | 83 | ] |
| 84 | 84 | ); |
| 85 | 85 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $this->template, |
| 108 | 108 | 'user/create', |
| 109 | 109 | [ |
| 110 | - 'param' => $formParam |
|
| 110 | + 'param' => $formParam |
|
| 111 | 111 | ] |
| 112 | 112 | ); |
| 113 | 113 | } |
@@ -10,8 +10,7 @@ discard block |
||
| 10 | 10 | use Platine\Validator\Rule\Number; |
| 11 | 11 | use Platine\Validator\Validator; |
| 12 | 12 | |
| 13 | -class UserValidator extends AbstractValidator |
|
| 14 | -{ |
|
| 13 | +class UserValidator extends AbstractValidator { |
|
| 15 | 14 | |
| 16 | 15 | protected UserParam $param; |
| 17 | 16 | |
@@ -20,8 +19,7 @@ discard block |
||
| 20 | 19 | * @param UserParam $param |
| 21 | 20 | * @param Validator|null $validator |
| 22 | 21 | */ |
| 23 | - public function __construct(UserParam $param, ?Validator $validator = null) |
|
| 24 | - { |
|
| 22 | + public function __construct(UserParam $param, ?Validator $validator = null) { |
|
| 25 | 23 | parent::__construct($validator); |
| 26 | 24 | $this->param = $param; |
| 27 | 25 | } |
@@ -39,30 +39,30 @@ |
||
| 39 | 39 | public function setRules(): void |
| 40 | 40 | { |
| 41 | 41 | $this->validator->addRules('username', [ |
| 42 | - new NotEmpty(), |
|
| 43 | - new MinLength(3), |
|
| 42 | + new NotEmpty(), |
|
| 43 | + new MinLength(3), |
|
| 44 | 44 | new AlphaDash() |
| 45 | 45 | ]); |
| 46 | 46 | |
| 47 | 47 | $this->validator->addRules('lastname', [ |
| 48 | - new NotEmpty(), |
|
| 49 | - new MinLength(3) |
|
| 48 | + new NotEmpty(), |
|
| 49 | + new MinLength(3) |
|
| 50 | 50 | ]); |
| 51 | 51 | |
| 52 | 52 | $this->validator->addRules('firstname', [ |
| 53 | - new NotEmpty(), |
|
| 54 | - new MinLength(3) |
|
| 53 | + new NotEmpty(), |
|
| 54 | + new MinLength(3) |
|
| 55 | 55 | ]); |
| 56 | 56 | |
| 57 | 57 | $this->validator->addRules('age', [ |
| 58 | - new NotEmpty(), |
|
| 59 | - new Number(), |
|
| 60 | - new Min(0), |
|
| 61 | - new Max(100), |
|
| 58 | + new NotEmpty(), |
|
| 59 | + new Number(), |
|
| 60 | + new Min(0), |
|
| 61 | + new Max(100), |
|
| 62 | 62 | ]); |
| 63 | 63 | |
| 64 | 64 | $this->validator->addRules('password', [ |
| 65 | - new MinLength(5), |
|
| 65 | + new MinLength(5), |
|
| 66 | 66 | ]); |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -2,8 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Platine\Framework\Demo\Form\Param; |
| 4 | 4 | |
| 5 | -class AuthParam extends BaseParam |
|
| 6 | -{ |
|
| 5 | +class AuthParam extends BaseParam { |
|
| 7 | 6 | protected string $username = ''; |
| 8 | 7 | protected string $password = ''; |
| 9 | 8 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $this->template, |
| 88 | 88 | 'user/edit', |
| 89 | 89 | [ |
| 90 | - 'param' => $formParam |
|
| 90 | + 'param' => $formParam |
|
| 91 | 91 | ] |
| 92 | 92 | ); |
| 93 | 93 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $this->template, |
| 114 | 114 | 'user/edit', |
| 115 | 115 | [ |
| 116 | - 'param' => $formParam |
|
| 116 | + 'param' => $formParam |
|
| 117 | 117 | ] |
| 118 | 118 | ); |
| 119 | 119 | } |
@@ -22,8 +22,7 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @author tony |
| 24 | 24 | */ |
| 25 | -class EditAction implements RequestHandlerInterface |
|
| 26 | -{ |
|
| 25 | +class EditAction implements RequestHandlerInterface { |
|
| 27 | 26 | |
| 28 | 27 | protected LoggerInterface $logger; |
| 29 | 28 | protected Session $session; |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @author tony |
| 18 | 18 | */ |
| 19 | -class DeleteAction implements RequestHandlerInterface |
|
| 20 | -{ |
|
| 19 | +class DeleteAction implements RequestHandlerInterface { |
|
| 21 | 20 | |
| 22 | 21 | protected LoggerInterface $logger; |
| 23 | 22 | protected UserRepository $userRepository; |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Platine\Orm\Entity; |
| 6 | 6 | |
| 7 | -class UserParam extends BaseParam |
|
| 8 | -{ |
|
| 7 | +class UserParam extends BaseParam { |
|
| 9 | 8 | protected string $username = ''; |
| 10 | 9 | protected string $lastname = ''; |
| 11 | 10 | protected string $firstname = ''; |