Connection   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 24
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getName() 0 3 1
A getDsn() 0 3 1
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of Biurad opensource projects.
5
 *
6
 * @copyright 2019 Biurad Group (https://biurad.com/)
7
 * @license   https://opensource.org/licenses/BSD-3-Clause License
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Flange\Database\Cycle\Config;
14
15
use Cycle\Database\Config\PDOConnectionConfig;
16
17
/**
18
 * {@inheritdoc}
19
 *
20
 * @author Divine Niiquaye Ibok <[email protected]>
21
 */
22
class Connection extends PDOConnectionConfig
23
{
24
    /**
25
     * @param array<string,mixed> $options
26
     */
27
    public function __construct(private string $dsn, ?string $username, ?string $password, array $options)
28
    {
29
        parent::__construct($username, $password, $options);
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function getName(): string
36
    {
37
        return \substr($this->dsn, \strpos($this->dsn, ':'));
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function getDsn(): string
44
    {
45
        return $this->dsn;
46
    }
47
}
48