| 1 | <?php  | 
            ||
| 10 | trait UrlParser  | 
            ||
| 11 | { | 
            ||
| 12 | /**  | 
            ||
| 13 | * URL encoder according to RFC 3986  | 
            ||
| 14 | * Returns a string containing the encoded URL with disallowed characters converted to their percentage encodings.  | 
            ||
| 15 | * @link http://publicmind.in/blog/url-encoding/  | 
            ||
| 16 | *  | 
            ||
| 17 | * @param string $url  | 
            ||
| 18 | * @return string  | 
            ||
| 19 | */  | 
            ||
| 20 | protected function urlEncode($url)  | 
            ||
| 45 | |||
| 46 | /**  | 
            ||
| 47 | * Validate URL  | 
            ||
| 48 | *  | 
            ||
| 49 | * @param string $url  | 
            ||
| 50 | * @return bool  | 
            ||
| 51 | */  | 
            ||
| 52 | protected function urlValidate($url)  | 
            ||
| 61 | |||
| 62 | /**  | 
            ||
| 63 | * Validate host name  | 
            ||
| 64 | *  | 
            ||
| 65 | * @link http://stackoverflow.com/questions/1755144/how-to-validate-domain-name-in-php  | 
            ||
| 66 | *  | 
            ||
| 67 | * @param string $host  | 
            ||
| 68 | * @return bool  | 
            ||
| 69 | */  | 
            ||
| 70 | protected static function urlValidateHost($host)  | 
            ||
| 78 | |||
| 79 | /**  | 
            ||
| 80 | * Validate URL scheme  | 
            ||
| 81 | *  | 
            ||
| 82 | * @param string $scheme  | 
            ||
| 83 | * @return bool  | 
            ||
| 84 | */  | 
            ||
| 85 | protected static function urlValidateScheme($scheme)  | 
            ||
| 93 | }  | 
            ||
| 94 |