Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Pull Request — 0.14 (#851)
by Jérémiah
08:23
created

AbstractConfig::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Generator\Config;
6
7
use InvalidArgumentException;
8
9
/**
10
 * @internal
11
 */
12
abstract class AbstractConfig
13
{
14
    protected const NORMALIZERS = [];
15
16 38
    public function __construct(array $config)
17
    {
18 38
        $this->populate($config);
19 38
    }
20
21 38
    protected function populate(array $config): void
22
    {
23 38
        foreach ($config as $key => $value) {
24 38
            $property = lcfirst(str_replace('_', '', ucwords($key, '_')));
25 38
            $normalizer = static::NORMALIZERS[$property] ?? 'normalize'.ucfirst($property);
26 38
            if (method_exists($this, $normalizer)) {
27 38
                $this->$property = $this->$normalizer($value);
28 38
            } elseif (property_exists($this, $property)) {
29 38
                $this->$property = $value;
30
            } else {
31
                throw new InvalidArgumentException(sprintf('Unknown config "%s".', $property));
32
            }
33
        }
34 38
    }
35
36
    /**
37
     * @param array|mixed $value
38
     */
39 32
    protected function normalizeCallback($value): Callback
40
    {
41 32
        return new Callback($value);
42
    }
43
44 3
    protected function normalizeValidation(array $config): Validation
45
    {
46 3
        return new Validation($config);
47
    }
48
}
49