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 (#137)
by Jérémiah
06:26
created

ConfigTypesPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 8
cts 8
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
crap 2
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\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Definition;
17
use Symfony\Component\ExpressionLanguage\Expression;
18
19
class ConfigTypesPass implements CompilerPassInterface
20
{
21 13
    public function process(ContainerBuilder $container)
22
    {
23 13
        $config = $container->getParameter('overblog_graphql_types.config');
24 13
        $generatedClasses = $container->get('overblog_graphql.cache_compiler')->compile($this->processConfig($config));
25
26 13
        foreach ($generatedClasses as $class => $file) {
27 13
            $aliases = call_user_func($class.'::getAliases');
28 13
            $this->setTypeServiceDefinition($container, $class, $aliases);
29 13
        }
30 13
    }
31
32 13
    private function setTypeServiceDefinition(ContainerBuilder $container, $class, array $aliases)
33
    {
34 13
        $definition = $container->setDefinition($class, new Definition($class));
35 13
        $definition->setPublic(false);
36 13
        $definition->setAutowired(true);
37 13
        foreach ($aliases as $alias) {
38 13
            $definition->addTag('overblog_graphql.type', ['alias' => $alias]);
39 13
        }
40 13
    }
41
42 13
    private function processConfig(array $configs)
43
    {
44 13
        return array_map(
45 13
            function ($v) {
46 13
                if (is_array($v)) {
47 13
                    return call_user_func([$this, 'processConfig'], $v);
48 13
                } elseif (is_string($v) && 0 === strpos($v, '@=')) {
49 9
                    return new Expression(substr($v, 2));
50
                }
51
52 13
                return $v;
53 13
            },
54
            $configs
55 13
        );
56
    }
57
}
58