Lines
100.00%
7 / 7
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 6 / 6 | 100.00% | 1 / 1 | 3 | ||
| [Lucent\Http\Exceptions\HttpException] getStatus | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| 19 | final class ModelBindingException extends HttpException | |
| 20 | { | |
| 21 | /** | |
| 22 | * @param class-string $model The model class that failed to resolve | |
| 23 | * @param array<string, mixed> $keys The [column => value] lookup attempted | |
| 24 | * @param string|null $reason Optional detail (e.g. "scope filtered the row") | |
| 25 | */ | |
| 26 | public function __construct( | |
| 27 | string $model, | |
| 28 | array $keys = [], | |
| 29 | ?string $reason = null, | |
| 30 | ) { | |
| 31 | $detail = $reason !== null && $reason !== '' ? " ({$reason})" : ''; | |
| 32 | ||
| 33 | parent::__construct( | |
| 34 | HttpStatus::NOT_FOUND, | |
| 35 | "Route model binding failed: no {$model} matches " | |
| 36 | . json_encode($keys, JSON_UNESCAPED_SLASHES) . $detail, | |
| 37 | ); | |
| 38 | } | |
| 39 | } |
Inherited from Lucent\Http\Exceptions\HttpException
| 20 | public function getStatus(): HttpStatus | |
| 21 | { | |
| 22 | return $this->status; | |
| 23 | } |