| Total Complexity | 6 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Coverage | 93.33% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class LoginRequest |
||
| 10 | { |
||
| 11 | /** @var string */ |
||
| 12 | private $email; |
||
| 13 | /** @var string */ |
||
| 14 | private $password; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * LoginRequest constructor. |
||
| 18 | * @param string $email |
||
| 19 | * @param string $password |
||
| 20 | */ |
||
| 21 | 4 | public function __construct(string $email, string $password) |
|
| 22 | { |
||
| 23 | 4 | $this->checkIsValidEmail($email); |
|
| 24 | 4 | $this->email = $email; |
|
| 25 | 4 | $this->password = $password; |
|
| 26 | 4 | } |
|
| 27 | |||
| 28 | /** |
||
| 29 | * @return string |
||
| 30 | */ |
||
| 31 | 1 | public function getEmail(): string |
|
| 32 | { |
||
| 33 | 1 | return $this->email; |
|
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @return string |
||
| 38 | */ |
||
| 39 | 1 | public function getPassword(): string |
|
| 40 | { |
||
| 41 | 1 | return $this->password; |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Check if email is valid |
||
| 46 | * |
||
| 47 | * @param string $email |
||
| 48 | * @throws InvalidArgumentException |
||
| 49 | */ |
||
| 50 | 4 | private function checkIsValidEmail(string $email): void |
|
| 54 | } |
||
| 55 | 4 | } |
|
| 56 | |||
| 57 | 4 | public function toArray() |
|
| 60 | } |
||
| 61 | } |