1 | <?php |
||
10 | final class URLParser |
||
11 | { |
||
12 | private $url; |
||
13 | |||
14 | /** |
||
15 | * Constructor |
||
16 | * |
||
17 | * @param string $url |
||
18 | */ |
||
19 | public function __construct($url) |
||
23 | |||
24 | /** |
||
25 | * Validate URL |
||
26 | * |
||
27 | * @return bool |
||
28 | */ |
||
29 | public function isValid() |
||
39 | |||
40 | /** |
||
41 | * URL encoder according to RFC 3986 |
||
42 | * Returns a string containing the encoded URL with disallowed characters converted to their percentage encodings. |
||
43 | * @link http://publicmind.in/blog/url-encoding/ |
||
44 | * |
||
45 | * @return string string |
||
46 | */ |
||
47 | public function encode() |
||
72 | |||
73 | /** |
||
74 | * Validate host name |
||
75 | * |
||
76 | * @link http://stackoverflow.com/questions/1755144/how-to-validate-domain-name-in-php |
||
77 | * @return bool |
||
78 | */ |
||
79 | public function isHostValid() |
||
87 | |||
88 | /** |
||
89 | * Validate URL scheme |
||
90 | * |
||
91 | * @return bool |
||
92 | */ |
||
93 | public function isSchemeValid() |
||
100 | } |
||
101 |