GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( b5dfb6...a568a9 )
by Mario
40:05
created

ActionsPass::process()   B

Complexity

Conditions 9
Paths 10

Size

Total Lines 44

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 44
rs 7.6604
c 0
b 0
f 0
cc 9
nc 10
nop 1
1
<?php
2
3
namespace Netgen\InformationCollection\Container\Compiler;
4
5
use Netgen\InformationCollection\API\Priority;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Exception\LogicException;
9
use Symfony\Component\DependencyInjection\Reference;
10
11
class ActionsPass implements CompilerPassInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function process(ContainerBuilder $container)
17
    {
18
        if (!$container->hasDefinition('netgen_information_collection.action.registry')) {
19
            return;
20
        }
21
22
        $actionAggregate = $container->getDefinition('netgen_information_collection.action.registry');
23
24
        foreach ($container->findTaggedServiceIds('netgen_information_collection.action') as $id => $attributes) {
25
            foreach ($attributes as $attribute) {
26
                if (!isset($attribute['alias'])) {
27
                    throw new LogicException(
28
                        "'netgen_information_collection.action' service tag " .
29
                        "needs an 'alias' attribute to identify the action. None given."
30
                    );
31
                }
32
33
                $priority = isset($attribute['priority']) ? $attribute['priority'] : Priority::DEFAULT_PRIORITY;
34
35
                if ($priority > Priority::MAX_PRIORITY && $attribute['alias'] !== 'database') {
36
                    throw new LogicException(
37
                        "Service {$id} uses priority greater than allowed. " .
38
                        'Priority must be lower than or equal to ' . Priority::MAX_PRIORITY . '.'
39
                    );
40
                }
41
42
                if ($priority < Priority::MIN_PRIORITY) {
43
                    throw new LogicException(
44
                        "Service {$id} uses priority less than allowed. " .
45
                        'Priority must be greater than or equal to ' . Priority::MIN_PRIORITY . '.'
46
                    );
47
                }
48
49
                $actionAggregate->addMethodCall(
50
                    'addAction',
51
                    array(
52
                        $attribute['alias'],
53
                        new Reference($id),
54
                        $priority,
55
                    )
56
                );
57
            }
58
        }
59
    }
60
}
61