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   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 28
rs 10
c 0
b 0
f 0
ccs 17
cts 17
cp 1
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createParams() 0 18 4
A getParams() 0 6 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