1 | <?php |
||
23 | trait HostnameTrait |
||
24 | { |
||
25 | /** |
||
26 | * Tells whether we have a IDN or not |
||
27 | * |
||
28 | * @var bool |
||
29 | */ |
||
30 | protected $isIdn = false; |
||
31 | |||
32 | /** |
||
33 | * Format an label collection for string representation of the Host |
||
34 | * |
||
35 | 6 | * @param array $labels host labels |
|
36 | * @param bool $convert should we transcode the labels into their ascii equivalent |
||
37 | 6 | * |
|
38 | * @return array |
||
39 | */ |
||
40 | protected function convertToAscii(array $labels, $convert) |
||
44 | |||
45 | /** |
||
46 | * Validate a string only host |
||
47 | * |
||
48 | 476 | * @param string $str |
|
49 | * |
||
50 | 476 | * @return array |
|
51 | */ |
||
52 | protected function validateStringHost($str) |
||
70 | |||
71 | 534 | /** |
|
72 | 490 | * set the FQDN property |
|
73 | * |
||
74 | * @param string $str |
||
75 | 490 | * |
|
76 | 490 | * @return string |
|
77 | */ |
||
78 | abstract protected function setIsAbsolute($str); |
||
79 | |||
80 | /** |
||
81 | * Convert to lowercase a string without modifying unicode characters |
||
82 | * |
||
83 | * @param string $str |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | protected function lower($str) |
||
93 | |||
94 | /** |
||
95 | 534 | * Validate a String Label |
|
96 | * |
||
97 | * @param array $labels found host labels |
||
98 | 14 | * |
|
99 | 534 | * @throws InvalidArgumentException If the validation fails |
|
100 | */ |
||
101 | protected function assertValidHost(array $labels) |
||
114 | |||
115 | 534 | /** |
|
116 | 10 | * Validated the Host Label Count |
|
117 | * |
||
118 | * @param array $labels host labels |
||
119 | 524 | * |
|
120 | 520 | * @throws InvalidArgumentException If the validation fails |
|
121 | 490 | */ |
|
122 | abstract protected function assertLabelsCount(array $labels); |
||
123 | |||
124 | /** |
||
125 | * Validated the Host Label Pattern |
||
126 | * |
||
127 | * @param array $data host labels |
||
128 | * |
||
129 | * @throws InvalidArgumentException If the validation fails |
||
130 | */ |
||
131 | protected function isValidContent(array $data) |
||
137 | } |
||
138 |