Connection::getDsn()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
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