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
07:11
created

ResolverConfigurator::__call()   B

Complexity

Conditions 5
Paths 3

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 5.3906

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 14
ccs 6
cts 8
cp 0.75
rs 8.8571
cc 5
eloc 7
nc 3
nop 2
crap 5.3906
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 25
    public function addMapping($name, array $mapping = [])
25
    {
26 25
        $this->mappings[$name] = $mapping;
27 25
    }
28
29 25
    private function configure(AbstractResolver $resolver, array $mapping)
30
    {
31 25
        foreach ($mapping as $name => $options) {
32 25
            $cleanOptions = $options;
33 25
            unset($cleanOptions['alias'], $cleanOptions['id']);
34
35 25
            $solution = $this->container->get($options['id']);
36
37 25
            if ($solution instanceof ContainerAwareInterface) {
38
                $solution->setContainer($this->container);
39
            }
40
41 25
            $resolver->addSolution($name, $solution, $cleanOptions);
42 25
        }
43 25
    }
44
45 25
    public function __call($name, $arguments)
46
    {
47 25
        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 25
        $mapping = $this->mappings[strtolower($matches[1])];
52
53 25
        if (!isset($arguments[0]) || !$arguments[0] instanceof AbstractResolver) {
54
            throw new \InvalidArgumentException('Resolver must implement "%s"', AbstractResolver::class);
55
        }
56
57 25
        $this->configure($arguments[0], $mapping);
58 25
    }
59
}
60