| Conditions | 5 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 21 | protected function getErrorHandler() |
||
| 22 | { |
||
| 23 | if (!$this->errorHandler) { |
||
| 24 | $this->errorHandler = function ($severity, $message, $file = '', $line = 0) { |
||
| 25 | restore_error_handler(); |
||
| 26 | $code = 0; |
||
| 27 | |||
| 28 | $patterns = array('/ORA-(\d+)/', '/OCI-(\d+)/'); |
||
| 29 | foreach ($patterns as $pattern) { |
||
| 30 | preg_match($pattern, $message, $matches); |
||
| 31 | if (is_array($matches) && array_key_exists(1, $matches)) { |
||
| 32 | $code = (int) $matches[1]; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | throw new Oci8Exception($message, $code, $severity, $file, $line); |
||
| 37 | }; |
||
| 38 | } |
||
| 39 | |||
| 40 | return $this->errorHandler; |
||
| 41 | } |
||
| 42 | } |
||
| 43 |