1 | <?php |
||
11 | trait UrlTools |
||
12 | { |
||
13 | /** |
||
14 | * Convert relative to full URL |
||
15 | * |
||
16 | * @param string $url |
||
17 | * @param string $base |
||
18 | * @return string |
||
19 | * @throws ClientException |
||
20 | */ |
||
21 | protected function urlConvertToFull($url, $base) |
||
31 | |||
32 | /** |
||
33 | * URL encoder according to RFC 3986 |
||
34 | * Returns a string containing the encoded URL with disallowed characters converted to their percentage encodings. |
||
35 | * @link http://publicmind.in/blog/url-encoding/ |
||
36 | * |
||
37 | * @param string $url |
||
38 | * @return string |
||
39 | */ |
||
40 | protected function urlEncode($url) |
||
68 | |||
69 | /** |
||
70 | * Validate URL |
||
71 | * |
||
72 | * @param string $url |
||
73 | * @return bool |
||
74 | */ |
||
75 | protected function urlValidate($url) |
||
84 | |||
85 | /** |
||
86 | * Validate host name |
||
87 | * |
||
88 | * @link http://stackoverflow.com/questions/1755144/how-to-validate-domain-name-in-php |
||
89 | * |
||
90 | * @param string $host |
||
91 | * @return bool |
||
92 | */ |
||
93 | protected static function urlValidateHost($host) |
||
102 | |||
103 | /** |
||
104 | * Validate URL scheme |
||
105 | * |
||
106 | * @param string $scheme |
||
107 | * @return bool |
||
108 | */ |
||
109 | protected static function urlValidateScheme($scheme) |
||
119 | |||
120 | /** |
||
121 | * Base URL |
||
122 | * |
||
123 | * @param string $url |
||
124 | * @return string |
||
125 | * @throws ClientException |
||
126 | */ |
||
127 | protected function urlBase($url) |
||
139 | } |
||
140 |