| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | public static function new(PDOException $exception): self |
||
| 14 | { |
||
| 15 | if ($exception->errorInfo !== null) { |
||
| 16 | [$sqlState, $code] = $exception->errorInfo; |
||
| 17 | |||
| 18 | $code ??= 0; |
||
| 19 | } else { |
||
| 20 | $code = $exception->getCode(); |
||
| 21 | $sqlState = null; |
||
| 22 | } |
||
| 23 | |||
| 24 | return new self($exception->getMessage(), $sqlState, $code, $exception); |
||
| 25 | } |
||
| 27 |