@@ -39,42 +39,42 @@ discard block |
||
39 | 39 | const TYPE_PHONE = 'phone'; |
40 | 40 | const TYPE_URL = 'url'; |
41 | 41 | |
42 | - /** |
|
43 | - * The original URL that was passed to the constructor. |
|
44 | - * @var string |
|
45 | - */ |
|
42 | + /** |
|
43 | + * The original URL that was passed to the constructor. |
|
44 | + * @var string |
|
45 | + */ |
|
46 | 46 | protected $rawURL; |
47 | 47 | |
48 | - /** |
|
49 | - * @var array |
|
50 | - */ |
|
48 | + /** |
|
49 | + * @var array |
|
50 | + */ |
|
51 | 51 | protected $info; |
52 | 52 | |
53 | - /** |
|
54 | - * @var string[] |
|
55 | - */ |
|
53 | + /** |
|
54 | + * @var string[] |
|
55 | + */ |
|
56 | 56 | protected $excludedParams = array(); |
57 | 57 | |
58 | - /** |
|
59 | - * @var bool |
|
60 | - * @see URLInfo::setParamExclusion() |
|
61 | - */ |
|
58 | + /** |
|
59 | + * @var bool |
|
60 | + * @see URLInfo::setParamExclusion() |
|
61 | + */ |
|
62 | 62 | protected $paramExclusion = false; |
63 | 63 | |
64 | - /** |
|
65 | - * @var array |
|
66 | - * @see URLInfo::getTypeLabel() |
|
67 | - */ |
|
64 | + /** |
|
65 | + * @var array |
|
66 | + * @see URLInfo::getTypeLabel() |
|
67 | + */ |
|
68 | 68 | protected static $typeLabels; |
69 | 69 | |
70 | - /** |
|
71 | - * @var bool |
|
72 | - */ |
|
70 | + /** |
|
71 | + * @var bool |
|
72 | + */ |
|
73 | 73 | protected $highlightExcluded = false; |
74 | 74 | |
75 | - /** |
|
76 | - * @var array |
|
77 | - */ |
|
75 | + /** |
|
76 | + * @var array |
|
77 | + */ |
|
78 | 78 | protected $infoKeys = array( |
79 | 79 | 'scheme', |
80 | 80 | 'host', |
@@ -86,24 +86,24 @@ discard block |
||
86 | 86 | 'fragment' |
87 | 87 | ); |
88 | 88 | |
89 | - /** |
|
90 | - * @var string |
|
91 | - */ |
|
89 | + /** |
|
90 | + * @var string |
|
91 | + */ |
|
92 | 92 | protected $url; |
93 | 93 | |
94 | - /** |
|
95 | - * @var URLInfo_Parser |
|
96 | - */ |
|
94 | + /** |
|
95 | + * @var URLInfo_Parser |
|
96 | + */ |
|
97 | 97 | protected $parser; |
98 | 98 | |
99 | - /** |
|
100 | - * @var URLInfo_Normalizer |
|
101 | - */ |
|
99 | + /** |
|
100 | + * @var URLInfo_Normalizer |
|
101 | + */ |
|
102 | 102 | protected $normalizer; |
103 | 103 | |
104 | - /** |
|
105 | - * @var bool |
|
106 | - */ |
|
104 | + /** |
|
105 | + * @var bool |
|
106 | + */ |
|
107 | 107 | protected $encodeUTFChars = false; |
108 | 108 | |
109 | 109 | public function __construct(string $url) |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | $this->info = $this->parser->getInfo(); |
121 | 121 | } |
122 | 122 | |
123 | - /** |
|
124 | - * Whether to URL encode any non-encoded UTF8 characters in the URL. |
|
125 | - * Default is to leave them as-is for better readability, since |
|
126 | - * browsers handle this well. |
|
127 | - * |
|
128 | - * @param bool $enabled |
|
129 | - * @return URLInfo |
|
130 | - */ |
|
123 | + /** |
|
124 | + * Whether to URL encode any non-encoded UTF8 characters in the URL. |
|
125 | + * Default is to leave them as-is for better readability, since |
|
126 | + * browsers handle this well. |
|
127 | + * |
|
128 | + * @param bool $enabled |
|
129 | + * @return URLInfo |
|
130 | + */ |
|
131 | 131 | public function setUTFEncoding(bool $enabled=true) : URLInfo |
132 | 132 | { |
133 | 133 | if($this->encodeUTFChars !== $enabled) |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | return $this->encodeUTFChars; |
145 | 145 | } |
146 | 146 | |
147 | - /** |
|
148 | - * Filters an URL: removes control characters and the |
|
149 | - * like to have a clean URL to work with. |
|
150 | - * |
|
151 | - * @param string $url |
|
152 | - * @return string |
|
153 | - */ |
|
147 | + /** |
|
148 | + * Filters an URL: removes control characters and the |
|
149 | + * like to have a clean URL to work with. |
|
150 | + * |
|
151 | + * @param string $url |
|
152 | + * @return string |
|
153 | + */ |
|
154 | 154 | public static function filterURL(string $url) |
155 | 155 | { |
156 | 156 | return URLInfo_Filter::filter($url); |
@@ -180,12 +180,12 @@ discard block |
||
180 | 180 | return $this->info['type'] === self::TYPE_PHONE; |
181 | 181 | } |
182 | 182 | |
183 | - /** |
|
184 | - * Whether the URL is a regular URL, not one of the |
|
185 | - * other types like a phone number or email address. |
|
186 | - * |
|
187 | - * @return bool |
|
188 | - */ |
|
183 | + /** |
|
184 | + * Whether the URL is a regular URL, not one of the |
|
185 | + * other types like a phone number or email address. |
|
186 | + * |
|
187 | + * @return bool |
|
188 | + */ |
|
189 | 189 | public function isURL() : bool |
190 | 190 | { |
191 | 191 | $host = $this->getHost(); |
@@ -197,20 +197,20 @@ discard block |
||
197 | 197 | return $this->parser->isValid(); |
198 | 198 | } |
199 | 199 | |
200 | - /** |
|
201 | - * Retrieves the host name, or an empty string if none is present. |
|
202 | - * |
|
203 | - * @return string |
|
204 | - */ |
|
200 | + /** |
|
201 | + * Retrieves the host name, or an empty string if none is present. |
|
202 | + * |
|
203 | + * @return string |
|
204 | + */ |
|
205 | 205 | public function getHost() : string |
206 | 206 | { |
207 | 207 | return $this->getInfoKey('host'); |
208 | 208 | } |
209 | 209 | |
210 | - /** |
|
211 | - * Retrieves the path, or an empty string if none is present. |
|
212 | - * @return string |
|
213 | - */ |
|
210 | + /** |
|
211 | + * Retrieves the path, or an empty string if none is present. |
|
212 | + * @return string |
|
213 | + */ |
|
214 | 214 | public function getPath() : string |
215 | 215 | { |
216 | 216 | return $this->getInfoKey('path'); |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | return $this->getInfoKey('scheme'); |
227 | 227 | } |
228 | 228 | |
229 | - /** |
|
230 | - * Retrieves the port specified in the URL, or -1 if none is preseent. |
|
231 | - * @return int |
|
232 | - */ |
|
229 | + /** |
|
230 | + * Retrieves the port specified in the URL, or -1 if none is preseent. |
|
231 | + * @return int |
|
232 | + */ |
|
233 | 233 | public function getPort() : int |
234 | 234 | { |
235 | 235 | $port = $this->getInfoKey('port'); |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | return -1; |
242 | 242 | } |
243 | 243 | |
244 | - /** |
|
245 | - * Retrieves the raw query string, or an empty string if none is present. |
|
246 | - * |
|
247 | - * @return string |
|
248 | - * |
|
249 | - * @see URLInfo::getParams() |
|
250 | - */ |
|
244 | + /** |
|
245 | + * Retrieves the raw query string, or an empty string if none is present. |
|
246 | + * |
|
247 | + * @return string |
|
248 | + * |
|
249 | + * @see URLInfo::getParams() |
|
250 | + */ |
|
251 | 251 | public function getQuery() : string |
252 | 252 | { |
253 | 253 | return $this->getInfoKey('query'); |
@@ -263,20 +263,20 @@ discard block |
||
263 | 263 | return $this->getInfoKey('pass'); |
264 | 264 | } |
265 | 265 | |
266 | - /** |
|
267 | - * Whether the URL contains a port number. |
|
268 | - * @return bool |
|
269 | - */ |
|
266 | + /** |
|
267 | + * Whether the URL contains a port number. |
|
268 | + * @return bool |
|
269 | + */ |
|
270 | 270 | public function hasPort() : bool |
271 | 271 | { |
272 | 272 | return $this->getPort() !== -1; |
273 | 273 | } |
274 | 274 | |
275 | - /** |
|
276 | - * Alias for the hasParams() method. |
|
277 | - * @return bool |
|
278 | - * @see URLInfo::hasParams() |
|
279 | - */ |
|
275 | + /** |
|
276 | + * Alias for the hasParams() method. |
|
277 | + * @return bool |
|
278 | + * @see URLInfo::hasParams() |
|
279 | + */ |
|
280 | 280 | public function hasQuery() : bool |
281 | 281 | { |
282 | 282 | return $this->hasParams(); |
@@ -321,23 +321,23 @@ discard block |
||
321 | 321 | return ''; |
322 | 322 | } |
323 | 323 | |
324 | - /** |
|
325 | - * Retrieves a normalized URL: this ensures that all parameters |
|
326 | - * in the URL are always in the same order. |
|
327 | - * |
|
328 | - * @return string |
|
329 | - */ |
|
324 | + /** |
|
325 | + * Retrieves a normalized URL: this ensures that all parameters |
|
326 | + * in the URL are always in the same order. |
|
327 | + * |
|
328 | + * @return string |
|
329 | + */ |
|
330 | 330 | public function getNormalized() : string |
331 | 331 | { |
332 | 332 | return $this->normalize(true); |
333 | 333 | } |
334 | 334 | |
335 | - /** |
|
336 | - * Like getNormalized(), but if a username and password are present |
|
337 | - * in the URL, returns the URL without them. |
|
338 | - * |
|
339 | - * @return string |
|
340 | - */ |
|
335 | + /** |
|
336 | + * Like getNormalized(), but if a username and password are present |
|
337 | + * in the URL, returns the URL without them. |
|
338 | + * |
|
339 | + * @return string |
|
340 | + */ |
|
341 | 341 | public function getNormalizedWithoutAuth() : string |
342 | 342 | { |
343 | 343 | return $this->normalize(false); |
@@ -358,25 +358,25 @@ discard block |
||
358 | 358 | return $this->normalizer->normalize(); |
359 | 359 | } |
360 | 360 | |
361 | - /** |
|
362 | - * Creates a hash of the URL, which can be used for comparisons. |
|
363 | - * Since any parameters in the URL's query are sorted alphabetically, |
|
364 | - * the same links with a different parameter order will have the |
|
365 | - * same hash. |
|
366 | - * |
|
367 | - * @return string |
|
368 | - */ |
|
361 | + /** |
|
362 | + * Creates a hash of the URL, which can be used for comparisons. |
|
363 | + * Since any parameters in the URL's query are sorted alphabetically, |
|
364 | + * the same links with a different parameter order will have the |
|
365 | + * same hash. |
|
366 | + * |
|
367 | + * @return string |
|
368 | + */ |
|
369 | 369 | public function getHash() |
370 | 370 | { |
371 | 371 | return \AppUtils\ConvertHelper::string2shortHash($this->getNormalized()); |
372 | 372 | } |
373 | 373 | |
374 | - /** |
|
375 | - * Highlights the URL using HTML tags with specific highlighting |
|
376 | - * class names. |
|
377 | - * |
|
378 | - * @return string Will return an empty string if the URL is not valid. |
|
379 | - */ |
|
374 | + /** |
|
375 | + * Highlights the URL using HTML tags with specific highlighting |
|
376 | + * class names. |
|
377 | + * |
|
378 | + * @return string Will return an empty string if the URL is not valid. |
|
379 | + */ |
|
380 | 380 | public function getHighlighted() : string |
381 | 381 | { |
382 | 382 | if(!$this->isValid()) { |
@@ -410,15 +410,15 @@ discard block |
||
410 | 410 | return count($params); |
411 | 411 | } |
412 | 412 | |
413 | - /** |
|
414 | - * Retrieves all parameters specified in the url, |
|
415 | - * if any, as an associative array. |
|
416 | - * |
|
417 | - * NOTE: Ignores parameters that have been added |
|
418 | - * to the excluded parameters list. |
|
419 | - * |
|
420 | - * @return array |
|
421 | - */ |
|
413 | + /** |
|
414 | + * Retrieves all parameters specified in the url, |
|
415 | + * if any, as an associative array. |
|
416 | + * |
|
417 | + * NOTE: Ignores parameters that have been added |
|
418 | + * to the excluded parameters list. |
|
419 | + * |
|
420 | + * @return array |
|
421 | + */ |
|
422 | 422 | public function getParams() : array |
423 | 423 | { |
424 | 424 | if(!$this->paramExclusion || empty($this->excludedParams)) { |
@@ -436,22 +436,22 @@ discard block |
||
436 | 436 | return $keep; |
437 | 437 | } |
438 | 438 | |
439 | - /** |
|
440 | - * Retrieves the names of all parameters present in the URL, if any. |
|
441 | - * @return string[] |
|
442 | - */ |
|
439 | + /** |
|
440 | + * Retrieves the names of all parameters present in the URL, if any. |
|
441 | + * @return string[] |
|
442 | + */ |
|
443 | 443 | public function getParamNames() : array |
444 | 444 | { |
445 | 445 | $params = $this->getParams(); |
446 | 446 | return array_keys($params); |
447 | 447 | } |
448 | 448 | |
449 | - /** |
|
450 | - * Retrieves a specific parameter value from the URL. |
|
451 | - * |
|
452 | - * @param string $name |
|
453 | - * @return string The parameter value, or an empty string if it does not exist. |
|
454 | - */ |
|
449 | + /** |
|
450 | + * Retrieves a specific parameter value from the URL. |
|
451 | + * |
|
452 | + * @param string $name |
|
453 | + * @return string The parameter value, or an empty string if it does not exist. |
|
454 | + */ |
|
455 | 455 | public function getParam(string $name) : string |
456 | 456 | { |
457 | 457 | if(isset($this->info['params'][$name])) { |
@@ -461,16 +461,16 @@ discard block |
||
461 | 461 | return ''; |
462 | 462 | } |
463 | 463 | |
464 | - /** |
|
465 | - * Excludes an URL parameter entirely if present: |
|
466 | - * the parser will act as if the parameter was not |
|
467 | - * even present in the source URL, effectively |
|
468 | - * stripping it. |
|
469 | - * |
|
470 | - * @param string $name |
|
471 | - * @param string $reason A human readable explanation why this is excluded - used when highlighting links. |
|
472 | - * @return URLInfo |
|
473 | - */ |
|
464 | + /** |
|
465 | + * Excludes an URL parameter entirely if present: |
|
466 | + * the parser will act as if the parameter was not |
|
467 | + * even present in the source URL, effectively |
|
468 | + * stripping it. |
|
469 | + * |
|
470 | + * @param string $name |
|
471 | + * @param string $reason A human readable explanation why this is excluded - used when highlighting links. |
|
472 | + * @return URLInfo |
|
473 | + */ |
|
474 | 474 | public function excludeParam(string $name, string $reason) : URLInfo |
475 | 475 | { |
476 | 476 | if(!isset($this->excludedParams[$name])) |
@@ -523,25 +523,25 @@ discard block |
||
523 | 523 | return self::$typeLabels[$this->getType()]; |
524 | 524 | } |
525 | 525 | |
526 | - /** |
|
527 | - * Whether excluded parameters should be highlighted in |
|
528 | - * a different color in the URL when using the |
|
529 | - * {@link URLInfo::getHighlighted()} method. |
|
530 | - * |
|
531 | - * @param bool $highlight |
|
532 | - * @return URLInfo |
|
533 | - */ |
|
526 | + /** |
|
527 | + * Whether excluded parameters should be highlighted in |
|
528 | + * a different color in the URL when using the |
|
529 | + * {@link URLInfo::getHighlighted()} method. |
|
530 | + * |
|
531 | + * @param bool $highlight |
|
532 | + * @return URLInfo |
|
533 | + */ |
|
534 | 534 | public function setHighlightExcluded(bool $highlight=true) : URLInfo |
535 | 535 | { |
536 | 536 | $this->highlightExcluded = $highlight; |
537 | 537 | return $this; |
538 | 538 | } |
539 | 539 | |
540 | - /** |
|
541 | - * Returns an array with all relevant URL information. |
|
542 | - * |
|
543 | - * @return array |
|
544 | - */ |
|
540 | + /** |
|
541 | + * Returns an array with all relevant URL information. |
|
542 | + * |
|
543 | + * @return array |
|
544 | + */ |
|
545 | 545 | public function toArray() : array |
546 | 546 | { |
547 | 547 | return array( |
@@ -585,24 +585,24 @@ discard block |
||
585 | 585 | return $this; |
586 | 586 | } |
587 | 587 | |
588 | - /** |
|
589 | - * Whether the parameter exclusion mode is enabled: |
|
590 | - * In this case, if any parameters have been added to the |
|
591 | - * exclusion list, all relevant methods will exclude these. |
|
592 | - * |
|
593 | - * @return bool |
|
594 | - */ |
|
588 | + /** |
|
589 | + * Whether the parameter exclusion mode is enabled: |
|
590 | + * In this case, if any parameters have been added to the |
|
591 | + * exclusion list, all relevant methods will exclude these. |
|
592 | + * |
|
593 | + * @return bool |
|
594 | + */ |
|
595 | 595 | public function isParamExclusionEnabled() : bool |
596 | 596 | { |
597 | 597 | return $this->paramExclusion; |
598 | 598 | } |
599 | 599 | |
600 | - /** |
|
601 | - * Checks whether the link contains any parameters that |
|
602 | - * are on the list of excluded parameters. |
|
603 | - * |
|
604 | - * @return bool |
|
605 | - */ |
|
600 | + /** |
|
601 | + * Checks whether the link contains any parameters that |
|
602 | + * are on the list of excluded parameters. |
|
603 | + * |
|
604 | + * @return bool |
|
605 | + */ |
|
606 | 606 | public function containsExcludedParams() : bool |
607 | 607 | { |
608 | 608 | if(empty($this->excludedParams)) { |
@@ -670,16 +670,16 @@ discard block |
||
670 | 670 | return $this->highlightExcluded; |
671 | 671 | } |
672 | 672 | |
673 | - /** |
|
674 | - * Checks if the URL exists, i.e. can be connected to. Will return |
|
675 | - * true if the returned HTTP status code is `200` or `302`. |
|
676 | - * |
|
677 | - * NOTE: If the target URL requires HTTP authentication, the username |
|
678 | - * and password should be integrated into the URL. |
|
679 | - * |
|
680 | - * @return bool |
|
681 | - * @throws BaseException |
|
682 | - */ |
|
673 | + /** |
|
674 | + * Checks if the URL exists, i.e. can be connected to. Will return |
|
675 | + * true if the returned HTTP status code is `200` or `302`. |
|
676 | + * |
|
677 | + * NOTE: If the target URL requires HTTP authentication, the username |
|
678 | + * and password should be integrated into the URL. |
|
679 | + * |
|
680 | + * @return bool |
|
681 | + * @throws BaseException |
|
682 | + */ |
|
683 | 683 | public function tryConnect(bool $verifySSL=true) : bool |
684 | 684 | { |
685 | 685 | requireCURL(); |
@@ -23,24 +23,24 @@ discard block |
||
23 | 23 | */ |
24 | 24 | class URLInfo_Parser |
25 | 25 | { |
26 | - /** |
|
27 | - * @var string |
|
28 | - */ |
|
26 | + /** |
|
27 | + * @var string |
|
28 | + */ |
|
29 | 29 | protected $url; |
30 | 30 | |
31 | - /** |
|
32 | - * @var bool |
|
33 | - */ |
|
31 | + /** |
|
32 | + * @var bool |
|
33 | + */ |
|
34 | 34 | protected $isValid = false; |
35 | 35 | |
36 | - /** |
|
37 | - * @var array |
|
38 | - */ |
|
36 | + /** |
|
37 | + * @var array |
|
38 | + */ |
|
39 | 39 | protected $info; |
40 | 40 | |
41 | - /** |
|
42 | - * @var array|NULL |
|
43 | - */ |
|
41 | + /** |
|
42 | + * @var array|NULL |
|
43 | + */ |
|
44 | 44 | protected $error; |
45 | 45 | |
46 | 46 | /** |
@@ -56,25 +56,25 @@ discard block |
||
56 | 56 | 'file' |
57 | 57 | ); |
58 | 58 | |
59 | - /** |
|
60 | - * Stores a list of all unicode characters in the URL |
|
61 | - * that have been filtered out before parsing it with |
|
62 | - * parse_url. |
|
63 | - * |
|
64 | - * @var string[]string |
|
65 | - */ |
|
59 | + /** |
|
60 | + * Stores a list of all unicode characters in the URL |
|
61 | + * that have been filtered out before parsing it with |
|
62 | + * parse_url. |
|
63 | + * |
|
64 | + * @var string[]string |
|
65 | + */ |
|
66 | 66 | protected $unicodeChars = array(); |
67 | 67 | |
68 | - /** |
|
69 | - * @var bool |
|
70 | - */ |
|
68 | + /** |
|
69 | + * @var bool |
|
70 | + */ |
|
71 | 71 | protected $encodeUTF = false; |
72 | 72 | |
73 | - /** |
|
74 | - * |
|
75 | - * @param string $url The target URL. |
|
76 | - * @param bool $encodeUTF Whether to URL encode any plain text unicode characters. |
|
77 | - */ |
|
73 | + /** |
|
74 | + * |
|
75 | + * @param string $url The target URL. |
|
76 | + * @param bool $encodeUTF Whether to URL encode any plain text unicode characters. |
|
77 | + */ |
|
78 | 78 | public function __construct(string $url, bool $encodeUTF) |
79 | 79 | { |
80 | 80 | $this->url = $url; |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | - /** |
|
91 | - * Retrieves the array as parsed by PHP's parse_url, |
|
92 | - * filtered and adjusted as necessary. |
|
93 | - * |
|
94 | - * @return array |
|
95 | - */ |
|
90 | + /** |
|
91 | + * Retrieves the array as parsed by PHP's parse_url, |
|
92 | + * filtered and adjusted as necessary. |
|
93 | + * |
|
94 | + * @return array |
|
95 | + */ |
|
96 | 96 | public function getInfo() : array |
97 | 97 | { |
98 | 98 | return $this->info; |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | - /** |
|
118 | - * Finds any non-url encoded unicode characters in |
|
119 | - * the URL, and encodes them before the URL is |
|
120 | - * passed to parse_url. |
|
121 | - */ |
|
117 | + /** |
|
118 | + * Finds any non-url encoded unicode characters in |
|
119 | + * the URL, and encodes them before the URL is |
|
120 | + * passed to parse_url. |
|
121 | + */ |
|
122 | 122 | protected function filterUnicodeChars() : void |
123 | 123 | { |
124 | 124 | $chars = \AppUtils\ConvertHelper::string2array($this->url); |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | return false; |
237 | 237 | } |
238 | 238 | |
239 | - /** |
|
240 | - * Goes through all information in the parse_url result |
|
241 | - * array, and attempts to fix any user errors in formatting |
|
242 | - * that can be recovered from, mostly regarding stray spaces. |
|
243 | - */ |
|
239 | + /** |
|
240 | + * Goes through all information in the parse_url result |
|
241 | + * array, and attempts to fix any user errors in formatting |
|
242 | + * that can be recovered from, mostly regarding stray spaces. |
|
243 | + */ |
|
244 | 244 | protected function filterParsed() |
245 | 245 | { |
246 | 246 | $this->info['params'] = array(); |
@@ -269,13 +269,13 @@ discard block |
||
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
272 | - /** |
|
273 | - * Recursively goes through the array, and converts all previously |
|
274 | - * URL encoded characters with their unicode character counterparts. |
|
275 | - * |
|
276 | - * @param array $subject |
|
277 | - * @return array |
|
278 | - */ |
|
272 | + /** |
|
273 | + * Recursively goes through the array, and converts all previously |
|
274 | + * URL encoded characters with their unicode character counterparts. |
|
275 | + * |
|
276 | + * @param array $subject |
|
277 | + * @return array |
|
278 | + */ |
|
279 | 279 | protected function restoreUnicodeChars(array $subject) : array |
280 | 280 | { |
281 | 281 | $result = array(); |
@@ -299,13 +299,13 @@ discard block |
||
299 | 299 | return $result; |
300 | 300 | } |
301 | 301 | |
302 | - /** |
|
303 | - * Replaces all URL encoded unicode characters |
|
304 | - * in the string with the unicode character. |
|
305 | - * |
|
306 | - * @param string $string |
|
307 | - * @return string |
|
308 | - */ |
|
302 | + /** |
|
303 | + * Replaces all URL encoded unicode characters |
|
304 | + * in the string with the unicode character. |
|
305 | + * |
|
306 | + * @param string $string |
|
307 | + * @return string |
|
308 | + */ |
|
309 | 309 | protected function restoreUnicodeChar(string $string) : string |
310 | 310 | { |
311 | 311 | if(strstr($string, '%')) |
@@ -363,21 +363,21 @@ discard block |
||
363 | 363 | ); |
364 | 364 | } |
365 | 365 | |
366 | - /** |
|
367 | - * Checks whether the URL that was parsed is valid. |
|
368 | - * @return bool |
|
369 | - */ |
|
366 | + /** |
|
367 | + * Checks whether the URL that was parsed is valid. |
|
368 | + * @return bool |
|
369 | + */ |
|
370 | 370 | public function isValid() : bool |
371 | 371 | { |
372 | 372 | return $this->isValid; |
373 | 373 | } |
374 | 374 | |
375 | - /** |
|
376 | - * If the validation failed, retrieves the validation |
|
377 | - * error message. |
|
378 | - * |
|
379 | - * @return string |
|
380 | - */ |
|
375 | + /** |
|
376 | + * If the validation failed, retrieves the validation |
|
377 | + * error message. |
|
378 | + * |
|
379 | + * @return string |
|
380 | + */ |
|
381 | 381 | public function getErrorMessage() : string |
382 | 382 | { |
383 | 383 | if(isset($this->error)) { |
@@ -387,12 +387,12 @@ discard block |
||
387 | 387 | return ''; |
388 | 388 | } |
389 | 389 | |
390 | - /** |
|
391 | - * If the validation failed, retrieves the validation |
|
392 | - * error code. |
|
393 | - * |
|
394 | - * @return int |
|
395 | - */ |
|
390 | + /** |
|
391 | + * If the validation failed, retrieves the validation |
|
392 | + * error code. |
|
393 | + * |
|
394 | + * @return int |
|
395 | + */ |
|
396 | 396 | public function getErrorCode() : int |
397 | 397 | { |
398 | 398 | if(isset($this->error)) { |