| Total Complexity | 5 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | abstract class ValidationException extends ResolvingException |
||
| 10 | { |
||
| 11 | use ClosureRendererTrait; |
||
|
|
|||
| 12 | |||
| 13 | 24 | final private function __construct( |
|
| 14 | protected readonly \ReflectionFunctionAbstract $reflection, |
||
| 15 | protected readonly string $parameter, |
||
| 16 | ?string $message = null, |
||
| 17 | ) { |
||
| 18 | 24 | $message ??= $this->getValidationMessage($reflection, $parameter); |
|
| 19 | 24 | parent::__construct($this->renderFunctionAndParameter($reflection, $message)); |
|
| 20 | } |
||
| 21 | |||
| 22 | 24 | public static function createWithParam(\ReflectionFunctionAbstract $reflection, string $parameter): static |
|
| 23 | { |
||
| 24 | 24 | return new static($reflection, $parameter); |
|
| 25 | } |
||
| 26 | |||
| 27 | 10 | public function getParameter(): string |
|
| 30 | } |
||
| 31 | |||
| 32 | 7 | protected static function createStatic(string $message, ?\Throwable $previous): static |
|
| 38 | } |
||
| 39 | |||
| 40 | abstract protected function getValidationMessage( |
||
| 41 | \ReflectionFunctionAbstract $reflection, |
||
| 42 | string $parameter, |
||
| 43 | ): string; |
||
| 44 | } |
||
| 45 |