| 1 | <?php |
||
| 17 | class InvalidUrlException extends InvalidArgumentException implements HttpCacheException |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @param string $url The invalid URL |
||
| 21 | * @param string $reason Further explanation why the URL was invalid (optional) |
||
| 22 | * |
||
| 23 | * @return self |
||
| 24 | */ |
||
| 25 | public static function invalidUrl($url, $reason = null) |
||
| 26 | { |
||
| 27 | $msg = sprintf('URL "%s" is invalid.', $url); |
||
| 28 | if ($reason) { |
||
|
|
|||
| 29 | $msg .= sprintf(' Reason: %s', $reason); |
||
| 30 | } |
||
| 31 | |||
| 32 | return new self($msg); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param string $server Invalid server |
||
| 37 | * @param array $allowed Allowed URL parts |
||
| 38 | * |
||
| 39 | * @return self |
||
| 40 | */ |
||
| 41 | public static function invalidUrlParts($server, array $allowed) |
||
| 49 | } |
||
| 50 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: