Total Complexity | 7 |
Total Lines | 68 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class EmailAddress |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | private $email; |
||
13 | |||
14 | public function __construct(string $email) |
||
17 | } |
||
18 | |||
19 | /** |
||
20 | * Returns the domain name portion of the email address. |
||
21 | * |
||
22 | * @return string|null |
||
23 | */ |
||
24 | public function getDomain(): ?string |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Returns the email address. |
||
31 | * |
||
32 | * @return string |
||
33 | */ |
||
34 | public function getEmailAddress(): string |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Returns the username of the email address. |
||
41 | * |
||
42 | * @since 1.1.0 |
||
43 | * @return string|null |
||
44 | */ |
||
45 | private function getUsername(): ?string |
||
46 | { |
||
47 | return explode('@', $this->email)[0] ?? null; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Determines if a gmail account is using the "plus trick". |
||
52 | * |
||
53 | * @since 1.1.0 |
||
54 | * @return bool |
||
55 | */ |
||
56 | public function isGmailWithPlusChar(): bool |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * Returns a gmail address with the "plus trick" portion of the email address. |
||
68 | * |
||
69 | * @since 1.1.0 |
||
70 | * @return string |
||
71 | */ |
||
72 | public function getGmailAddressWithoutPlus(): string |
||
75 | } |
||
76 | } |
||
77 |