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
Pull Request — master (#5)
by Jérémiah
03:24
created

ResolverConfigurator   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 9
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 44
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addMapping() 0 4 1
A configure() 0 15 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
    public function addMapping($name, array $mapping = [])
25
    {
26
        $this->mappings[$name] = $mapping;
27
    }
28
29
    private function configure(AbstractResolver $resolver, array $mapping)
30
    {
31
        foreach ($mapping as $name => $options) {
32
            $cleanOptions = $options;
33
            unset($cleanOptions['alias'], $cleanOptions['id']);
34
35
            $solution = $this->container->get($options['id']);
36
37
            if ($solution instanceof ContainerAwareInterface) {
38
                $solution->setContainer($this->container);
39
            }
40
41
            $resolver->addSolution($name, $solution, $cleanOptions);
42
        }
43
    }
44
45
    public function __call($name, $arguments)
46
    {
47
        if (!preg_match('/^configure(.*)/i', $name, $matches) || !isset($this->mappings[strtolower($matches[1])])) {
48
            throw new \BadMethodCallException(sprintf('Call to unknown method %s', $name));
49
        }
50
51
        $mapping = $this->mappings[strtolower($matches[1])];
52
53
        if (!isset($arguments[0]) || !$arguments[0] instanceof AbstractResolver) {
54
            throw new \InvalidArgumentException(
55
                sprintf('Resolver must implement "%s"', 'Overblog\\GraphQLBundle\\Resolver\\AbstractResolver')
56
            );
57
        }
58
59
        $this->configure($arguments[0], $mapping);
60
    }
61
}
62