| Total Complexity | 9 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | final class InvalidMiddlewareDefinitionException extends InvalidArgumentException |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @param array|callable|string $middlewareDefinition |
||
| 19 | */ |
||
| 20 | 46 | public function __construct($middlewareDefinition, int $code = 0, ?Throwable $previous = null) |
|
| 21 | { |
||
| 22 | 46 | $message = 'Parameter should be either middleware class name or a callable.'; |
|
| 23 | |||
| 24 | 46 | $definitionString = $this->convertDefinitionToString($middlewareDefinition); |
|
| 25 | 46 | if ($definitionString !== null) { |
|
| 26 | 34 | $message .= ' Got ' . $definitionString . '.'; |
|
| 27 | } |
||
| 28 | |||
| 29 | 46 | parent::__construct($message, $code, $previous); |
|
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @return string|null |
||
| 34 | */ |
||
| 35 | 46 | private function convertDefinitionToString(mixed $middlewareDefinition): ?string |
|
| 68 | } |
||
| 69 | } |
||
| 70 |