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 ( 21cf6c...173932 )
by Benjamin
03:31 queued 48s
created

Connection   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 22
dl 0
loc 38
ccs 21
cts 21
cp 1
rs 10
c 0
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A createParams() 0 17 4
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
                continue;
40
            }
41 1
            if ($key === 'password') {
42 1
                $password = $val;
43 1
                continue;
44
            }
45 1
            $params[$key] = $val;
46
        }
47 1
        return [$params, $username, $password];
48
    }
49
}
50