Total Complexity | 4 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
5 | class Email |
||
6 | { |
||
7 | /** |
||
8 | * @var string |
||
9 | */ |
||
10 | private $value; |
||
11 | |||
12 | /** |
||
13 | * @param string $value |
||
14 | */ |
||
15 | public function __construct(string $value) |
||
16 | { |
||
17 | if (!filter_var($value, FILTER_VALIDATE_EMAIL)) { |
||
18 | throw new \InvalidArgumentException('Invalid value '.$value.' for email'); |
||
19 | } |
||
20 | |||
21 | $this->value = $value; |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * @return string |
||
26 | */ |
||
27 | public function toNative(): string |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param Email $email |
||
34 | * @return bool |
||
35 | */ |
||
36 | public function equals(Email $email): bool |
||
39 | } |
||
40 | } |
||
41 |