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   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 43
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A create() 0 4 1
A load() 0 10 2
A addPostLoader() 0 4 1
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