771c7befcc328a937367367aa6e12fc6de7aa4f6
[GitHub/WoltLab/WCF.git] /
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Laminas\Diactoros\Exception;
6
7 use function gettype;
8 use function is_object;
9 use function sprintf;
10
11 class InvalidProxyAddressException extends RuntimeException implements ExceptionInterface
12 {
13 public static function forInvalidProxyArgument(mixed $proxy): self
14 {
15 $type = is_object($proxy) ? $proxy::class : gettype($proxy);
16 return new self(sprintf(
17 'Invalid proxy of type "%s" provided;'
18 . ' must be a valid IPv4 or IPv6 address, optionally with a subnet mask provided'
19 . ' or an array of such values',
20 $type,
21 ));
22 }
23
24 public static function forAddress(string $address): self
25 {
26 return new self(sprintf(
27 'Invalid proxy address "%s" provided;'
28 . ' must be a valid IPv4 or IPv6 address, optionally with a subnet mask provided',
29 $address,
30 ));
31 }
32 }