Passed
Push — master ( 7656d0...dbe1c1 )
by Divine Niiquaye
04:04
created

Connection::getDsn()   A

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
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of DivineNii opensource projects.
7
 *
8
 * PHP version 7.4 and above required
9
 *
10
 * @author    Divine Niiquaye Ibok <[email protected]>
11
 * @copyright 2019 DivineNii (https://divinenii.com/)
12
 * @license   https://opensource.org/licenses/BSD-3-Clause License
13
 *
14
 * For the full copyright and license information, please view the LICENSE
15
 * file that was distributed with this source code.
16
 */
17
18
namespace Rade\Database\Cycle\Config;
19
20
use Cycle\Database\Config\PDOConnectionConfig;
0 ignored issues
show
Bug introduced by
The type Cycle\Database\Config\PDOConnectionConfig was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
22
/**
23
 * {@inheritdoc}
24
 *
25
 * @author Divine Niiquaye Ibok <[email protected]>
26
 */
27
class Connection extends PDOConnectionConfig
28
{
29
    private string $dsn;
30
31
    /**
32
     * @param array<string,mixed> $options
33
     */
34
    public function __construct(string $dsn, ?string $username, ?string $password, array $options)
35
    {
36
        $this->dsn = $dsn;
37
        parent::__construct($username, $password, $options);
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function getName(): string
44
    {
45
        return \substr($this->dsn, \strpos($this->dsn, ':'));
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getDsn(): string
52
    {
53
        return $this->dsn;
54
    }
55
}
56