Failed Conditions
Pull Request — 2.10.x (#3979)
by Ben
31:35 queued 27:39
created

OCI8Exception::fromErrorInfo()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
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 \Doctrine\DBAL\Driver\OCI8\OCI8Exception
16
     */
17
    public static function fromErrorInfo($error)
18
    {
19
        if ($error === false) {
20
            return new self('Database error occurred but no error information was retrieved from the driver.');
21
        }
22
23
        return new self($error['message'], null, $error['code']);
24
    }
25
}
26