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