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

Passed
Pull Request — master (#277)
by Jérémiah
14:57
created

GlobalVariablesPass   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 3
dl 0
loc 35
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
C process() 0 29 7
1
<?php
2
3
namespace Overblog\GraphQLBundle\DependencyInjection\Compiler;
4
5
use Overblog\GraphQLBundle\Definition\GlobalVariables;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
final class GlobalVariablesPass implements CompilerPassInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 32
    public function process(ContainerBuilder $container)
16
    {
17 32
        $taggedServices = $container->findTaggedServiceIds('overblog_graphql.global_variable', true);
18 32
        $globalVariables = ['container' => new Reference('service_container')];
19 32
        $expressionLanguageDefinition = $container->findDefinition('overblog_graphql.expression_language');
20
21 32
        foreach ($taggedServices as $id => $tags) {
22 32
            foreach ($tags as $attributes) {
23 32
                if (empty($attributes['alias']) || !is_string($attributes['alias'])) {
24 6
                    throw new \InvalidArgumentException(
25 6
                        sprintf('Service "%s" tagged "overblog_graphql.global_variable" should have a valid "alias" attribute.', $id)
26
                    );
27
                }
28 26
                $globalVariables[$attributes['alias']] = new Reference($id);
29
30 26
                $isPublic = isset($attributes['public']) ? (bool) $attributes['public'] : true;
31 26
                if ($isPublic) {
32 26
                    $expressionLanguageDefinition->addMethodCall(
33 26
                        'addGlobalName',
34
                        [
35 26
                            sprintf('globalVariables->get(\'%s\')', $attributes['alias']),
36 26
                            $attributes['alias'],
37
                        ]
38
                    );
39
                }
40
            }
41
        }
42 26
        $container->findDefinition(GlobalVariables::class)->setArguments([$globalVariables]);
43 26
    }
44
}
45