Total Complexity | 5 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | class InternalErrorException extends RuntimeException |
||
22 | { |
||
23 | /** @var mixed[] */ |
||
24 | protected $data; |
||
25 | |||
26 | /** |
||
27 | * InternalErrorException constructor. |
||
28 | * @param string $message |
||
29 | * @param int $code |
||
30 | * @param Throwable|null $previous |
||
31 | * @param mixed[]|null $data |
||
32 | */ |
||
33 | public function __construct( |
||
34 | string $message = "", |
||
35 | int $code = 0, |
||
36 | Throwable $previous = null, |
||
37 | array $data = null |
||
38 | ) { |
||
39 | if ($previous !== null && $data === null) { |
||
40 | $this->data = [ |
||
41 | 'exception' => get_class($previous), |
||
42 | 'code' => $previous->getCode(), |
||
43 | 'file' => $previous->getFile(), |
||
44 | 'line' => $previous->getLine(), |
||
45 | ]; |
||
46 | } elseif ($data !== null) { |
||
47 | $this->data = $data; |
||
48 | } |
||
49 | |||
50 | parent::__construct($message, $code, $previous); |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return mixed[]|null |
||
55 | */ |
||
56 | public function getData(): ?array |
||
59 | } |
||
60 | } |
||
61 |