@@ -42,18 +42,18 @@ discard block |
||
42 | 42 | protected bool $isValid = false; |
43 | 43 | protected bool $encodeUTF = false; |
44 | 44 | |
45 | - /** |
|
46 | - * @var array{code:int,message:string}|NULL |
|
47 | - */ |
|
45 | + /** |
|
46 | + * @var array{code:int,message:string}|NULL |
|
47 | + */ |
|
48 | 48 | protected ?array $error = null; |
49 | 49 | |
50 | - /** |
|
51 | - * Stores a list of all unicode characters in the URL |
|
52 | - * that have been filtered out before parsing it with |
|
53 | - * parse_url. |
|
54 | - * |
|
55 | - * @var array<string,string> |
|
56 | - */ |
|
50 | + /** |
|
51 | + * Stores a list of all unicode characters in the URL |
|
52 | + * that have been filtered out before parsing it with |
|
53 | + * parse_url. |
|
54 | + * |
|
55 | + * @var array<string,string> |
|
56 | + */ |
|
57 | 57 | protected array $unicodeChars = array(); |
58 | 58 | |
59 | 59 | /** |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | ); |
79 | 79 | |
80 | 80 | /** |
81 | - * |
|
82 | - * @param string $url The target URL. |
|
83 | - * @param bool $encodeUTF Whether to URL encode any plain text unicode characters. |
|
84 | - */ |
|
81 | + * |
|
82 | + * @param string $url The target URL. |
|
83 | + * @param bool $encodeUTF Whether to URL encode any plain text unicode characters. |
|
84 | + */ |
|
85 | 85 | public function __construct(string $url, bool $encodeUTF) |
86 | 86 | { |
87 | 87 | $this->url = $url; |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | $this->validate(); |
93 | 93 | } |
94 | 94 | |
95 | - /** |
|
96 | - * Retrieves the array as parsed by PHP's parse_url, |
|
97 | - * filtered and adjusted as necessary. |
|
98 | - * |
|
99 | - * @return array<string,mixed> |
|
100 | - */ |
|
95 | + /** |
|
96 | + * Retrieves the array as parsed by PHP's parse_url, |
|
97 | + * filtered and adjusted as necessary. |
|
98 | + * |
|
99 | + * @return array<string,mixed> |
|
100 | + */ |
|
101 | 101 | public function getInfo() : array |
102 | 102 | { |
103 | 103 | return $this->info; |
@@ -153,11 +153,11 @@ discard block |
||
153 | 153 | $this->url = implode(':', $parts); |
154 | 154 | } |
155 | 155 | |
156 | - /** |
|
157 | - * Finds any non-url encoded unicode characters in |
|
158 | - * the URL, and encodes them before the URL is |
|
159 | - * passed to parse_url. |
|
160 | - */ |
|
156 | + /** |
|
157 | + * Finds any non-url encoded unicode characters in |
|
158 | + * the URL, and encodes them before the URL is |
|
159 | + * passed to parse_url. |
|
160 | + */ |
|
161 | 161 | protected function filterUnicodeChars() : void |
162 | 162 | { |
163 | 163 | $chars = ConvertHelper::string2array($this->url); |
@@ -228,23 +228,23 @@ discard block |
||
228 | 228 | $this->isValid = true; |
229 | 229 | } |
230 | 230 | |
231 | - /** |
|
232 | - * Goes through all information in the parse_url result |
|
233 | - * array, and attempts to fix any user errors in formatting |
|
234 | - * that can be recovered from, mostly regarding stray spaces. |
|
235 | - */ |
|
231 | + /** |
|
232 | + * Goes through all information in the parse_url result |
|
233 | + * array, and attempts to fix any user errors in formatting |
|
234 | + * that can be recovered from, mostly regarding stray spaces. |
|
235 | + */ |
|
236 | 236 | protected function filterParsed() : void |
237 | 237 | { |
238 | 238 | $this->info = (new ParsedInfoFilter($this->url, $this->info))->filter(); |
239 | 239 | } |
240 | 240 | |
241 | - /** |
|
242 | - * Recursively goes through the array, and converts all previously |
|
243 | - * URL encoded characters with their unicode character counterparts. |
|
244 | - * |
|
245 | - * @param array<string,mixed> $subject |
|
246 | - * @return array<string,mixed> |
|
247 | - */ |
|
241 | + /** |
|
242 | + * Recursively goes through the array, and converts all previously |
|
243 | + * URL encoded characters with their unicode character counterparts. |
|
244 | + * |
|
245 | + * @param array<string,mixed> $subject |
|
246 | + * @return array<string,mixed> |
|
247 | + */ |
|
248 | 248 | protected function restoreUnicodeChars(array $subject) : array |
249 | 249 | { |
250 | 250 | $result = array(); |
@@ -268,13 +268,13 @@ discard block |
||
268 | 268 | return $result; |
269 | 269 | } |
270 | 270 | |
271 | - /** |
|
272 | - * Replaces all URL encoded unicode characters |
|
273 | - * in the string with the unicode character. |
|
274 | - * |
|
275 | - * @param string $string |
|
276 | - * @return string |
|
277 | - */ |
|
271 | + /** |
|
272 | + * Replaces all URL encoded unicode characters |
|
273 | + * in the string with the unicode character. |
|
274 | + * |
|
275 | + * @param string $string |
|
276 | + * @return string |
|
277 | + */ |
|
278 | 278 | protected function restoreUnicodeChar(string $string) : string |
279 | 279 | { |
280 | 280 | if(strpos($string, '%') !== false) |
@@ -295,32 +295,32 @@ discard block |
||
295 | 295 | ); |
296 | 296 | } |
297 | 297 | |
298 | - /** |
|
299 | - * Checks whether the URL that was parsed is valid. |
|
300 | - * @return bool |
|
301 | - */ |
|
298 | + /** |
|
299 | + * Checks whether the URL that was parsed is valid. |
|
300 | + * @return bool |
|
301 | + */ |
|
302 | 302 | public function isValid() : bool |
303 | 303 | { |
304 | 304 | return $this->isValid; |
305 | 305 | } |
306 | 306 | |
307 | - /** |
|
308 | - * If the validation failed, retrieves the validation |
|
309 | - * error message. |
|
310 | - * |
|
311 | - * @return string |
|
312 | - */ |
|
307 | + /** |
|
308 | + * If the validation failed, retrieves the validation |
|
309 | + * error message. |
|
310 | + * |
|
311 | + * @return string |
|
312 | + */ |
|
313 | 313 | public function getErrorMessage() : string |
314 | 314 | { |
315 | 315 | return $this->error['message'] ?? ''; |
316 | 316 | } |
317 | 317 | |
318 | - /** |
|
319 | - * If the validation failed, retrieves the validation |
|
320 | - * error code. |
|
321 | - * |
|
322 | - * @return int |
|
323 | - */ |
|
318 | + /** |
|
319 | + * If the validation failed, retrieves the validation |
|
320 | + * error code. |
|
321 | + * |
|
322 | + * @return int |
|
323 | + */ |
|
324 | 324 | public function getErrorCode() : int |
325 | 325 | { |
326 | 326 | return $this->error['code'] ?? -1; |