| Conditions | 7 |
| Paths | 6 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 7 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 16 | public function throwMoreConcreteException(PDOException $exception) { |
||
| 17 | $code = $exception->errorInfo[1]; |
||
| 18 | $message = (string) $exception->errorInfo[2]; |
||
| 19 | switch($code) { |
||
| 20 | case 2006: throw new DatabaseHasGoneAwayException($message, $code, $exception); |
||
| 21 | case 1213: throw new SqlDeadLockException($message, $code, $exception); |
||
| 22 | case 1205: throw new LockWaitTimeoutExceededException($message, $code, $exception); |
||
| 23 | case 1062: throw new DuplicateUniqueKeyException($message, $code, $exception); |
||
| 24 | } |
||
| 25 | /** @link http://php.net/manual/en/class.exception.php#Hcom115813 (cHao's comment) */ |
||
| 26 | if(!is_string($message) || !is_int($code)) { |
||
| 27 | throw new SqlException((string) $message, (int) $code, $exception); |
||
| 28 | } |
||
| 29 | throw $exception; |
||
| 30 | } |
||
| 31 | } |
||
| 32 |