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 ( 40c845...e97398 )
by Benjamin
02:50
created

YamlConfigurator::createParams()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 4

Importance

Changes 0
Metric Value
cc 4
eloc 12
nc 4
nop 1
dl 0
loc 18
rs 9.8666
c 0
b 0
f 0
ccs 13
cts 13
cp 1
crap 4
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