1 | <?php |
||
19 | class Host |
||
20 | { |
||
21 | /** |
||
22 | * @var string Subdomain |
||
23 | */ |
||
24 | protected $subdomain; |
||
25 | |||
26 | /** |
||
27 | * @var string Registrable domain |
||
28 | */ |
||
29 | protected $registrableDomain; |
||
30 | |||
31 | /** |
||
32 | * @var string Public suffix |
||
33 | */ |
||
34 | protected $publicSuffix; |
||
35 | |||
36 | /** |
||
37 | * @var string host Entire host part |
||
38 | */ |
||
39 | protected $host = ''; |
||
40 | |||
41 | /** |
||
42 | * Public constructor. |
||
43 | * |
||
44 | * @param string|null $subdomain Subdomain portion of host |
||
45 | * @param string|null $registrableDomain Registrable domain portion of host |
||
46 | * @param string|null $publicSuffix Public suffix portion of host |
||
47 | * @param string $host OPTIONAL Entire host part |
||
48 | */ |
||
49 | 24 | public function __construct($subdomain, $registrableDomain, $publicSuffix, $host = '') |
|
56 | |||
57 | /** |
||
58 | * Get Subdomain. |
||
59 | * |
||
60 | * @return string|null |
||
61 | */ |
||
62 | 7 | public function getSubdomain() |
|
66 | |||
67 | /** |
||
68 | * @return string|null |
||
69 | */ |
||
70 | 7 | public function getRegistrableDomain() |
|
74 | |||
75 | /** |
||
76 | * Get Public suffix. |
||
77 | * |
||
78 | * @return string|null |
||
79 | */ |
||
80 | 8 | public function getPublicSuffix() |
|
84 | |||
85 | /** |
||
86 | * Get Entire host part. |
||
87 | * |
||
88 | * @return string|null |
||
89 | */ |
||
90 | 6 | public function getHost() |
|
94 | |||
95 | /** |
||
96 | * Get string representation of host. |
||
97 | * |
||
98 | * @return string String representation of host |
||
99 | */ |
||
100 | 15 | public function __toString() |
|
114 | |||
115 | /** |
||
116 | * Get array representation of host. |
||
117 | * |
||
118 | * @return array Array representation of host |
||
119 | */ |
||
120 | 6 | public function toArray(): array |
|
129 | } |
||
130 |