1 | <?php |
||
11 | trait UrlTools |
||
12 | { |
||
13 | /** |
||
14 | * URL encoder according to RFC 3986 |
||
15 | * Returns a string containing the encoded URL with disallowed characters converted to their percentage encodings. |
||
16 | * @link http://publicmind.in/blog/url-encoding/ |
||
17 | * |
||
18 | * @param string $url |
||
19 | * @return string |
||
20 | */ |
||
21 | protected function urlEncode($url) |
||
49 | |||
50 | /** |
||
51 | * Base URL |
||
52 | * |
||
53 | * @param string $url |
||
54 | * @return string |
||
55 | * @throws ClientException |
||
56 | */ |
||
57 | protected function urlBase($url) |
||
69 | |||
70 | /** |
||
71 | * Validate URL |
||
72 | * |
||
73 | * @param string $url |
||
74 | * @return bool |
||
75 | */ |
||
76 | protected function urlValidate($url) |
||
85 | |||
86 | /** |
||
87 | * Validate host name |
||
88 | * |
||
89 | * @link http://stackoverflow.com/questions/1755144/how-to-validate-domain-name-in-php |
||
90 | * |
||
91 | * @param string $host |
||
92 | * @return bool |
||
93 | */ |
||
94 | protected static function urlValidateHost($host) |
||
103 | |||
104 | /** |
||
105 | * Validate URL scheme |
||
106 | * |
||
107 | * @param string $scheme |
||
108 | * @return bool |
||
109 | */ |
||
110 | protected static function urlValidateScheme($scheme) |
||
120 | } |
||
121 |