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.
Passed
Push — master ( 99a73b...17f115 )
by Benjamin
02:45
created

Connection::__construct()   B

Complexity

Conditions 5
Paths 3

Size

Total Lines 25
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 0
Metric Value
cc 5
eloc 16
nc 3
nop 0
dl 0
loc 25
ccs 0
cts 23
cp 0
crap 30
rs 8.439
c 0
b 0
f 0
1
<?php
2
3
namespace Lib\Db\Dbal;
4
5
use PDO;
6
use Symfony\Component\Yaml\Parser;
7
8
class Connection extends PDO
9
{
10
    public function __construct()
11
    {
12
        $keys     = ['host', 'port', 'dbname', 'unix_socket', 'charset'];
13
        $parser   = new Parser();
14
        $config   = $parser->parseFile(__DIR__.'/../../../../config/config.yml')['database'];
15
        $dsn      = $config['type'].';';
16
        $userpass = [];
17
18
        foreach ($config as $key => val) {
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected ')', expecting '[' on line 18 at column 39
Loading history...
19
            if (!\in_array($key, $keys)) {
20
                if (\in_array($key, ['username', 'password'])) {
21
                    $userpass[$key] = $val;
22
                }
23
                unset($config[$key]);
24
            }
25
        }
26
        foreach ($keys as $key) {
27
            if (isset($config[$key])) {
28
                $dsn .= "{$key}={$config[$key]};";
29
            }
30
        }
31
        parent::__construct($dsn, $userpass['username'], $userpass['password'], []);
32
    }
33
}
34