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.

YamlConfigurator::getParams()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
ccs 4
cts 4
cp 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * Created by PhpStorm.
6
 * User: benjamin
7
 * Date: 26/01/19
8
 * Time: 21:40.
9
 */
10
11
namespace Lib\DB\DBAL\Configurator;
12
13
use Symfony\Component\Yaml\Parser;
14
15
class YamlConfigurator implements ConfiguratorInterface
16
{
17 1
    public function getParams(): array
18
    {
19 1
        $parser = new Parser();
20 1
        $config = $parser->parseFile(getenv('APP_ROOT').'/config/config.yml')['database'];
21
22 1
        return $this->createParams($config);
23
    }
24
25 1
    private function createParams(array $config): array
26
    {
27 1
        $username = '';
28 1
        $password = '';
29 1
        $params = [];
30 1
        foreach ($config as $key => $val) {
31 1
            if ($key === 'username') {
32 1
                $username = $val;
33 1
                continue;
34
            }
35 1
            if ($key === 'password') {
36 1
                $password = $val;
37 1
                continue;
38
            }
39 1
            $params[$key] = $val;
40
        }
41
42 1
        return [$params, $username, $password];
43
    }
44
}
45