Completed
Push — 2.10.x ( 61a6b9...f20ba1 )
by Grégoire
13:37 queued 11s
created

OCI8Exception   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 14
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromErrorInfo() 0 7 2
1
<?php
2
3
namespace Doctrine\DBAL\Driver\OCI8;
4
5
use Doctrine\DBAL\Driver\AbstractDriverException;
6
7
/**
8
 * @psalm-immutable
9
 */
10
class OCI8Exception extends AbstractDriverException
11
{
12
    /**
13
     * @param mixed[]|false $error
14
     *
15
     * @return OCI8Exception
16
     */
17 154
    public static function fromErrorInfo($error)
18
    {
19 154
        if ($error === false) {
20 2
            return new self('Database error occurred but no error information was retrieved from the driver.');
21
        }
22
23 152
        return new self($error['message'], null, $error['code']);
24
    }
25
}
26