Total Complexity | 6 |
Total Lines | 70 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class CacheDatabaseException extends BaseException |
||
8 | { |
||
9 | |||
10 | /** @param string $before */ |
||
11 | private static string $before = "<Database Cache Store Exception>"; |
||
12 | |||
13 | /** |
||
14 | * Creates a new instance of CacheDatabaseException. |
||
15 | * |
||
16 | * @param string $message |
||
17 | * @param int $code |
||
18 | * @param Exception|null $previous |
||
19 | * @param array $details |
||
20 | * @return self |
||
21 | */ |
||
22 | public static function create(string $message = "", int $code = 0, ?Exception $previous = null, array $details = []) |
||
23 | { |
||
24 | return new self(self::getBefore() . ": " .$message, $code, $previous, $details); |
||
25 | } |
||
26 | |||
27 | |||
28 | /** |
||
29 | * Gets the static text that will be prepended to the exception message. |
||
30 | * |
||
31 | * @return string |
||
32 | */ |
||
33 | public static function getBefore(): string |
||
34 | { |
||
35 | return self::$before; |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Sets the static text that will be prepended to the exception message. |
||
40 | * |
||
41 | * @return void |
||
42 | */ |
||
43 | public static function setBefore(string $text) |
||
44 | { |
||
45 | self::$before = $text; |
||
46 | } |
||
47 | |||
48 | /* |
||
49 | * Converts the exception to an array representation. |
||
50 | * |
||
51 | * @return array |
||
52 | */ |
||
53 | public function toArray() |
||
54 | { |
||
55 | return parent::toArray(); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Converts the exception to a JSON serializable format. |
||
60 | * |
||
61 | * @return string |
||
62 | */ |
||
63 | public function jsonSerialize(): array |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * Converts the exception to a JSON string. |
||
70 | * |
||
71 | * @param int $options |
||
72 | * @return string |
||
73 | */ |
||
74 | public function toJson(int $options = 0) |
||
77 | } |
||
78 | } |
||
79 |