| Total Complexity | 2 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 23 | class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface |
||
| 24 | { |
||
| 25 | /** @var array<int,string> */ |
||
| 26 | private array $methods; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param array<int,string> $methods |
||
| 30 | */ |
||
| 31 | 7 | public function __construct(array $methods, string $path, string $method) |
|
| 32 | { |
||
| 33 | 7 | $this->methods = \array_map('strtoupper', $methods); |
|
| 34 | 7 | $message = 'Route with "%s" path requires request method(s) [%s], "%s" is invalid.'; |
|
| 35 | |||
| 36 | 7 | parent::__construct(\sprintf($message, $path, \implode(',', $methods), $method), 405); |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Gets allowed methods. |
||
| 41 | * |
||
| 42 | * @return array<int,string> |
||
| 43 | */ |
||
| 44 | 1 | public function getAllowedMethods(): array |
|
| 47 | } |
||
| 48 | } |
||
| 49 |