| Conditions | 6 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | 164 | public static function isRfc($url) |
|
| 30 | { |
||
| 31 | 164 | if(isset($url) && 1 < strlen($url)) { |
|
| 32 | 162 | $host = self::parseHost($url); |
|
| 33 | 162 | $scheme = strtolower(parse_url($url, PHP_URL_SCHEME)); |
|
| 34 | 162 | if (false !== $host && ($scheme == 'http' || $scheme == 'https')) { |
|
| 35 | 158 | $pattern = '([A-Za-z][A-Za-z0-9+.-]{1,120}:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@&~=-])'; |
|
| 36 | 158 | $pattern .= '|%[A-Fa-f0-9]{2}){1,333}(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@&~=%-]{0,1000}))?)'; |
|
| 37 | 158 | return (bool) preg_match($pattern, $url); |
|
| 38 | } |
||
| 39 | 4 | } |
|
| 40 | 6 | return false; |
|
| 41 | } |
||
| 42 | } |
||
| 43 |