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