Driver::connect()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 0
cts 5
cp 0
rs 10
cc 1
nc 1
nop 4
crap 2
1
<?php
2
3
namespace Adgoal\DBALFaultTolerance\Driver\Mysqli;
4
5
use Adgoal\DBALFaultTolerance\Driver\DriverInterface;
6
use Adgoal\DBALFaultTolerance\Driver\ServerGoneAwayExceptionsAwareTrait;
7
use Doctrine\DBAL\DBALException;
8
9
/**
10
 * Class Driver.
11
 */
12
class Driver extends \Doctrine\DBAL\Driver\Mysqli\Driver implements DriverInterface
13
{
14
    use ServerGoneAwayExceptionsAwareTrait;
15
16
    /**
17
     * @var array
18
     */
19
    private $extendedDriverOptions = [
20
        'x_reconnect_attempts',
21
    ];
22
23
    /**
24
     * {@inheritdoc}
25
     *
26
     * @throws DBALException
27
     */
28
    public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
29
    {
30
        $driverOptions = array_diff_key($driverOptions, array_flip($this->extendedDriverOptions));
31
32
        return parent::connect($params, $username, $password, $driverOptions);
33
    }
34
}
35