Completed
Push — master ( 292d81...c07ed1 )
by Sergei
47:58 queued 44:41
created

OCI8Exception::fromErrorInfo()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.1481

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2.1481
1
<?php
2
3
namespace Doctrine\DBAL\Driver\OCI8;
4
5
use Doctrine\DBAL\Driver\AbstractDriverException;
6
7
class OCI8Exception extends AbstractDriverException
8
{
9
    /**
10
     * @param mixed[]|false $error
11
     *
12
     * @return \Doctrine\DBAL\Driver\OCI8\OCI8Exception
13
     */
14 153
    public static function fromErrorInfo($error)
15
    {
16 153
        if ($error === false) {
17 4
            return new self('Database error occurred but no error information was retrieved from the driver.');
18
        }
19
20 149
        return new self($error['message'], null, $error['code']);
21
    }
22
}
23