Driver   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 14
dl 0
loc 24
ccs 0
cts 11
cp 0
rs 10
c 2
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A connect() 0 22 3
1
<?php
2
3
/**
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 *
7
 * @see https://github.com/ecphp
8
 */
9
10
declare(strict_types=1);
11
12
namespace EcPhp\DoctrineOci8\Doctrine\DBAL\Driver\OCI8;
13
14
use Doctrine\DBAL\Driver\OCI8\Driver as BaseDriver;
15
use Doctrine\DBAL\Driver\OCI8\OCI8Exception;
16
use Doctrine\DBAL\Exception as DBALException;
17
use Throwable;
18
19
use const OCI_DEFAULT;
20
21
final class Driver extends BaseDriver
22
{
23
    public function connect(
24
        array $params,
25
        $username = null,
26
        $password = null,
27
        array $driverOptions = []
28
    ): OCI8Connection {
29
        try {
30
            $connection = new OCI8Connection(
31
                $username,
32
                $password,
33
                $this->_constructDsn($params),
34
                $params['charset'] ?? null,
35
                $params['sessionMode'] ?? OCI_DEFAULT,
36
                $params['persistent'] ?? false
37
            );
38
        } catch (OCI8Exception $e) {
39
            throw DBALException::driverException($this, $e);
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\DBAL\DBALException::driverException() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

39
            throw /** @scrutinizer ignore-deprecated */ DBALException::driverException($this, $e);
Loading history...
40
        } catch (Throwable $e) {
41
            throw $e;
42
        }
43
44
        return $connection;
45
    }
46
}
47