| Total Complexity | 7 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 7 | class LoginDetails |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var Email |
||
| 11 | */ |
||
| 12 | private $email; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | private $password; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param array $values |
||
| 21 | */ |
||
| 22 | public function __construct(array $values) |
||
| 23 | { |
||
| 24 | if (!isset($values['email']) || !isset($values['password'])) { |
||
| 25 | throw new \InvalidArgumentException('Both email and password are required.'); |
||
| 26 | } |
||
| 27 | |||
| 28 | if ($values['email'] === '' || $values['password'] === '') { |
||
| 29 | throw new \InvalidArgumentException('Email and password can\'t be empty.'); |
||
| 30 | } |
||
| 31 | |||
| 32 | $this->email = new Email($values['email']); |
||
| 33 | $this->password = $values['password']; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @return Email |
||
| 38 | */ |
||
| 39 | public function getEmail(): Email |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | public function getPassword(): string |
||
| 50 | } |
||
| 51 | } |
||
| 52 |