Total Complexity | 3 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class Exception extends \RuntimeException |
||
10 | { |
||
11 | /** @var array */ |
||
12 | protected $errorInfo; |
||
13 | |||
14 | /** |
||
15 | * Exception constructor. |
||
16 | * |
||
17 | * @param array $errorInfo |
||
18 | * @param string $message |
||
19 | * @param int $code |
||
20 | * @param Throwable|null $previous |
||
21 | */ |
||
22 | public function __construct(array $errorInfo, $message = "", $code = 0, Throwable $previous = null) |
||
23 | { |
||
24 | if (array_diff(array_keys($errorInfo), [0, 1, 2])) { |
||
25 | throw new \RuntimeException(sprintf('Invalid errorInfo received for constructing %s.', __CLASS__)); |
||
26 | } |
||
27 | |||
28 | $this->errorInfo = $errorInfo; |
||
29 | |||
30 | parent::__construct($message, $code, $previous); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @return array |
||
35 | */ |
||
36 | public function getErrorInfo(): array |
||
39 | } |
||
40 | } |
||
41 |