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   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 4
dl 0
loc 50
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B process() 0 44 9
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