| Conditions | 5 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 31 | public function __construct(array $error, Throwable $previous = null) |
||
| 32 | { |
||
| 33 | $message = $error['message'] ?? 'Unknown error'; |
||
| 34 | |||
| 35 | $code = (int)($error['code'] ?? 0); |
||
| 36 | |||
| 37 | $data = null; |
||
| 38 | if (isset($error['data']) && is_array($error['data'])) { |
||
| 39 | $data = (object)$error['data']; |
||
| 40 | } |
||
| 41 | if (isset($error['data']) && $error['data'] instanceof stdClass) { |
||
| 42 | $data = $error['data']; |
||
| 43 | } |
||
| 44 | |||
| 45 | parent::__construct($message, $code, $previous, $data); |
||
| 46 | } |
||
| 48 |