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

Completed
Push — master ( 087fbe...bf5629 )
by Jérémiah
09:13
created

ResolverConfigurator   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 73.91%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 9
c 2
b 0
f 1
lcom 1
cbo 4
dl 0
loc 42
ccs 17
cts 23
cp 0.7391
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addMapping() 0 4 1
A configure() 0 13 3
B __call() 0 16 5
1
<?php
2
3
/*
4
 * This file is part of the OverblogGraphQLBundle package.
5
 *
6
 * (c) Overblog <http://github.com/overblog/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Overblog\GraphQLBundle\DependencyInjection\Configurator;
13
14
use Overblog\GraphQLBundle\Resolver\AbstractResolver;
15
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
16
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
17
18
class ResolverConfigurator implements ContainerAwareInterface
19
{
20
    use ContainerAwareTrait;
21
22
    private $mappings;
23
24 26
    public function addMapping($name, array $mapping = [])
25
    {
26 26
        $this->mappings[$name] = $mapping;
27 26
    }
28
29 26
    private function configure(AbstractResolver $resolver, array $mapping)
30
    {
31 26
        foreach ($mapping as $name => $options) {
32 26
            $cleanOptions = $options;
33 26
            $solution = $this->container->get($options['id']);
34
35 26
            if ($solution instanceof ContainerAwareInterface) {
36
                $solution->setContainer($this->container);
37
            }
38
39 26
            $resolver->addSolution($name, $solution, $cleanOptions);
40 26
        }
41 26
    }
42
43 26
    public function __call($name, $arguments)
44
    {
45 26
        if (!preg_match('/^configure(.*)/i', $name, $matches) || !isset($this->mappings[strtolower($matches[1])])) {
46
            throw new \BadMethodCallException(sprintf('Call to unknown method %s', $name));
47
        }
48
49 26
        $mapping = $this->mappings[strtolower($matches[1])];
50
51 26
        if (!isset($arguments[0]) || !$arguments[0] instanceof AbstractResolver) {
52
            throw new \InvalidArgumentException(
53
                sprintf('Resolver must implement "%s"', 'Overblog\\GraphQLBundle\\Resolver\\AbstractResolver')
54
            );
55
        }
56
57 26
        $this->configure($arguments[0], $mapping);
58 26
    }
59
}
60