GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( b88bc4...2341f0 )
by Benjamin
02:09
created

Connection::createParams()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 4

Importance

Changes 0
Metric Value
cc 4
eloc 11
nc 4
nop 1
dl 0
loc 15
ccs 11
cts 11
cp 1
crap 4
rs 9.9
c 0
b 0
f 0
1
<?php
2
3
namespace Lib\DB\DBAL;
4
5
use Lib\DB\DBAL\Connection\ConnectionInterface;
6
use Lib\DB\DBAL\Driver\DriverInterface;
7
use Lib\DB\DBAL\Driver\PDODriver;
8
use Symfony\Component\Yaml\Parser;
9
10
class Connection
11
{
12
    /** @var DriverInterface */
13
    private $driver;
14
15
    /** @var ConnectionInterface */
16
    private $conn;
17
18
    /** @var bool */
19
    private $isConnected = false;
20
21 1
    public function __construct()
22
    {
23 1
        $parser = new Parser();
24 1
        $config = $parser->parseFile(__DIR__.'/../../../../config/config.yml')['database'];
25 1
        [$params, $username, $password] = $this->createParams($config);
26 1
        $this->driver = new PDODriver();
27 1
        $this->conn = $this->driver->connect($params, $username, $password);
28 1
        $this->isConnected = true;
29 1
    }
30
31 1
    private function createParams($config)
32
    {
33 1
        $username = '';
34 1
        $password = '';
35 1
        $params = [];
36 1
        foreach ($config as $key => $val) {
37 1
            if ($key === 'username') {
38 1
                $username = $val;
39 1
            } elseif ($key === 'password') {
40 1
                $password = $val;
41
            } else {
42 1
                $params[$key] = $val;
43
            }
44
        }
45 1
        return [$params, $username, $password];
46
    }
47
}
48