Total Complexity | 6 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class ConnectionException extends BaseException |
||
8 | { |
||
9 | private static string $before = "<Connection Exception>"; |
||
10 | |||
11 | /** |
||
12 | * @param string $message |
||
13 | * @param int $code |
||
14 | * @param Exception|null $previous |
||
15 | * @param array $details |
||
16 | * @return self |
||
17 | */ |
||
18 | public static function create(string $message = "", int $code = 0, ?Exception $previous = null, array $details = []) |
||
19 | { |
||
20 | return new self(self::getBefore() . ": " . $message, $code, $previous, $details); |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * @return string |
||
25 | */ |
||
26 | public static function getBefore(): string |
||
27 | { |
||
28 | return self::$before; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @param string $text |
||
33 | */ |
||
34 | public static function setBefore(string $text): void |
||
35 | { |
||
36 | self::$before = $text; |
||
37 | } |
||
38 | |||
39 | /* |
||
40 | * @return array |
||
41 | */ |
||
42 | public function toArray() |
||
43 | { |
||
44 | return parent::toArray(); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @return string |
||
49 | */ |
||
50 | public function jsonSerialize(): array |
||
51 | { |
||
52 | return parent::jsonSerialize(); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @param int $options |
||
57 | * @return string |
||
58 | */ |
||
59 | public function toJson(int $options = 0) |
||
62 | } |
||
63 | } |
||
64 |