5a3bc3bad533a085950383142fd174c06ca1c404
[GitHub/WoltLab/WCF.git] /
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Laminas\Diactoros\Exception;
6
7 use Laminas\Diactoros\ServerRequestFilter\FilterUsingXForwardedHeaders;
8
9 use function gettype;
10 use function is_object;
11 use function is_string;
12 use function sprintf;
13
14 class InvalidForwardedHeaderNameException extends RuntimeException implements ExceptionInterface
15 {
16 public static function forHeader(mixed $name): self
17 {
18 if (! is_string($name)) {
19 $name = sprintf('(value of type %s)', is_object($name) ? $name::class : gettype($name));
20 }
21
22 return new self(sprintf(
23 'Invalid X-Forwarded-* header name "%s" provided to %s',
24 $name,
25 FilterUsingXForwardedHeaders::class
26 ));
27 }
28 }