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 — master (#277)
by Jérémiah
22:38 queued 19:05
created

LazyConfig::load()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Overblog\GraphQLBundle\Definition;
4
5
final class LazyConfig
6
{
7
    /** @var \Closure */
8
    private $loader;
9
10
    /** @var GlobalVariables */
11
    private $globalVariables;
12
13
    /**
14
     * @var callable
15
     */
16
    private $onPostLoad = [];
17
18 79
    private function __construct(\Closure $loader, GlobalVariables $globalVariables = null)
19
    {
20 79
        $this->loader = $loader;
21 79
        $this->globalVariables = $globalVariables ?: new GlobalVariables();
22 79
    }
23
24 79
    public static function create(\Closure $loader, GlobalVariables $globalVariables = null)
25
    {
26 79
        return new self($loader, $globalVariables);
27
    }
28
29
    /**
30
     * @return array
31
     */
32 77
    public function load()
33
    {
34 77
        $loader = $this->loader;
35 77
        $config = $loader($this->globalVariables);
36 77
        foreach ($this->onPostLoad as $postLoader) {
0 ignored issues
show
Bug introduced by
The expression $this->onPostLoad of type callable is not traversable.
Loading history...
37 77
            $config = $postLoader($config);
38
        }
39
40 77
        return $config;
41
    }
42
43 77
    public function addPostLoader(callable $postLoader)
44
    {
45 77
        $this->onPostLoad[] = $postLoader;
46 77
    }
47
}
48