Passed
Push — develop ( 91e6f7...043ba3 )
by Greg
17:29 queued 04:55
created

Connection   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 25
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
1
<?php
2
3
/**
4
 * webtrees: online genealogy
5
 * Copyright (C) 2022 webtrees development team
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
 * GNU General Public License for more details.
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
 */
17
18
declare(strict_types=1);
19
20
namespace Fisharebest\Webtrees\Database;
21
22
use Doctrine\Common\EventManager;
23
use Doctrine\DBAL\Configuration;
24
use Doctrine\DBAL\Connection as DbalConnection;
25
use Doctrine\DBAL\Driver;
26
use Doctrine\DBAL\Exception;
27
28
/**
29
 * Extend doctrine/dbal to support prefixed table names.
30
 */
31
class Connection extends DbalConnection
32
{
33
    private string $prefix;
34
35
    /**
36
     * Initializes a new instance of the Connection class.
37
     *
38
     * @param string              $prefix
39
     * @param array<string,mixed> $params
40
     * @param Driver              $driver
41
     * @param Configuration|null  $config
42
     * @param EventManager|null   $eventManager
43
     *
44
     * @throws Exception
45
     */
46
    public function __construct(
47
        string $prefix,
48
        array $params,
49
        Driver $driver,
50
        ?Configuration $config = null,
51
        ?EventManager $eventManager = null
52
    ) {
53
        $this->prefix = $prefix;
54
55
        parent::__construct($params, $driver, $config, $eventManager);
56
    }
57
}
58