Total Complexity | 10 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class EmailValue |
||
10 | { |
||
11 | private $userName; |
||
12 | private $domain; |
||
13 | |||
14 | public function __construct(string $emailAddress) |
||
27 | } |
||
28 | } |
||
29 | |||
30 | public function getUserName(): string |
||
31 | { |
||
32 | return $this->userName; |
||
33 | } |
||
34 | |||
35 | public function getDomain(): string |
||
36 | { |
||
37 | return $this->domain; |
||
38 | } |
||
39 | |||
40 | public function getNormalizedDomain(): string |
||
41 | { |
||
42 | return (string)idn_to_ascii($this->domain, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46); |
||
43 | } |
||
44 | |||
45 | public function getFullAddress(): string |
||
46 | { |
||
47 | return $this->userName . '@' . $this->domain; |
||
48 | } |
||
49 | |||
50 | public function getNormalizedAddress(): string |
||
51 | { |
||
52 | return $this->userName . '@' . $this->getNormalizedDomain(); |
||
53 | } |
||
54 | |||
55 | public function __toString(): string |
||
58 | } |
||
59 | |||
60 | |||
61 | } |