Passed
Pull Request — master (#3808)
by Sergei
09:45
created

OCI8Exception::fromErrorInfo()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

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