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

FieldAnonymizerVisitorPass::process()   B

Complexity

Conditions 6
Paths 9

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 8.9297
c 0
b 0
f 0
cc 6
nc 9
nop 1
1
<?php
2
3
namespace Netgen\InformationCollection\Container\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class FieldAnonymizerVisitorPass implements CompilerPassInterface
10
{
11
    /**
12
     * Service ID of aggregate visitor.
13
     *
14
     * @see \Netgen\Bundle\InformationCollectionBundle\Core\Persistence\Anonymizer\Visitor\Field\Aggregate
15
     *
16
     * @var string
17
     */
18
    private $aggregateVisitorId = 'netgen_information_collection.anonymizer.visitor.field.aggregate';
19
20
    /**
21
     * Service tag used for field anonymizer visitors.
22
     *
23
     * @see \Netgen\Bundle\InformationCollectionBundle\API\Persistence\Anonymizer\Visitor\FieldAnonymizerVisitor
24
     *
25
     * @var string
26
     */
27
    private $visitorTag = 'netgen_information_collection.anonymizer.visitor.field';
28
29
    public function process(ContainerBuilder $container)
30
    {
31
        if (!$container->has($this->aggregateVisitorId)) {
32
            return;
33
        }
34
35
        $aggregateVisitorDefinition = $container->getDefinition($this->aggregateVisitorId);
36
        $visitors = $container->findTaggedServiceIds($this->visitorTag);
37
        $visitorsByPriority = [];
38
39
        foreach ($visitors as $id => $tags) {
40
            foreach ($tags as $tag) {
41
                $priority = isset($tag['priority']) ? (int)$tag['priority'] : 0;
42
                $visitorsByPriority[$priority][] = new Reference($id);
43
            }
44
        }
45
46
        if (count($visitorsByPriority) > 0) {
47
            krsort($visitorsByPriority);
48
            $visitors = array_merge(...$visitorsByPriority);
49
            $aggregateVisitorDefinition->setArguments([$visitors]);
50
        }
51
    }
52
}
53