1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the ICanBoogie package. |
||
5 | * |
||
6 | * (c) Olivier Laviale <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace ICanBoogie\ActiveRecord; |
||
13 | |||
14 | use ICanBoogie\Accessor\AccessorTrait; |
||
15 | use LogicException; |
||
16 | use Throwable; |
||
17 | |||
18 | /** |
||
19 | * Exception thrown when there is no driver defined for a given driver name. |
||
20 | * |
||
21 | * @property-read string $driver_name |
||
22 | */ |
||
23 | class DriverNotDefined extends LogicException implements Exception |
||
24 | { |
||
25 | /** |
||
26 | * @param non-empty-string $driver_name |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
27 | * @param non-empty-string|null $message |
||
28 | */ |
||
29 | public function __construct( |
||
30 | public readonly string $driver_name, |
||
31 | string $message = null, |
||
32 | Throwable $previous = null |
||
33 | ) { |
||
34 | parent::__construct($message ?? $this->format_message($driver_name), 0, $previous); |
||
35 | } |
||
36 | |||
37 | private function format_message(string $driver_name): string |
||
38 | { |
||
39 | return "Driver not defined for: $driver_name."; |
||
40 | } |
||
41 | } |
||
42 |