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
05:30
created

ConfigTypesPass   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 3
dl 0
loc 39
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 10 2
A setTypeServiceDefinition() 0 9 2
A processConfig() 0 15 4
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
    public function process(ContainerBuilder $container)
22
    {
23
        $config = $container->getParameter('overblog_graphql_types.config');
24
        $generatedClasses = $container->get('overblog_graphql.cache_compiler')->compile($this->processConfig($config));
25
26
        foreach ($generatedClasses as $class => $file) {
27
            $aliases = call_user_func($class.'::getAliases');
28
            $this->setTypeServiceDefinition($container, $class, $aliases);
29
        }
30
    }
31
32
    private function setTypeServiceDefinition(ContainerBuilder $container, $class, array $aliases)
33
    {
34
        $definition = $container->setDefinition($class, new Definition($class));
35
        $definition->setPublic(false);
36
        $definition->setAutowired(true);
37
        foreach ($aliases as $alias) {
38
            $definition->addTag('overblog_graphql.type', ['alias' => $alias]);
39
        }
40
    }
41
42
    private function processConfig(array $configs)
43
    {
44
        return array_map(
45
            function ($v) {
46
                if (is_array($v)) {
47
                    return call_user_func([$this, 'processConfig'], $v);
48
                } elseif (is_string($v) && 0 === strpos($v, '@=')) {
49
                    return new Expression(substr($v, 2));
50
                }
51
52
                return $v;
53
            },
54
            $configs
55
        );
56
    }
57
}
58