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.
Test Setup Failed
Push — master ( aeed96...e25155 )
by Malte
03:19
created

ShortcodeCompilerPass   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 13
c 1
b 0
f 0
dl 0
loc 24
rs 10
ccs 13
cts 13
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 22 5
1
<?php
2
3
namespace Webfactory\ShortcodeBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
use Thunder\Shortcode\HandlerContainer\HandlerContainer;
9
use Webfactory\ShortcodeBundle\Controller\GuideController;
10
11
/**
12
 * CompilerPass that prepares the shortcode handler container and the GuideController (if configured).
13
 */
14 8
class ShortcodeCompilerPass implements CompilerPassInterface
15
{
16 8
    public function process(ContainerBuilder $container)
17
    {
18
        $shortcodeServices = $container->findTaggedServiceIds('webfactory.shortcode');
19 8
20 8
        // add services tagged with webfactory.shortcode as handlers to the short code handler container
21 4
        $handlerContainer = $container->findDefinition(HandlerContainer::class);
22 4
        foreach ($shortcodeServices as $id => $shortcodeTags) {
23
            foreach ($shortcodeTags as $shortcodeTag) {
24
                $handlerContainer->addMethodCall('add', [$shortcodeTag['shortcode'], new Reference($id)]);
25
            }
26
        }
27 8
28 2
        // prepare the GuideController if it's configuration is imported
29 2
        if ($container->has(GuideController::class)) {
30 2
            $allShortcodeTags = [];
31
            foreach ($shortcodeServices as $id => $shortcodeTags) {
32
                $allShortcodeTags = array_merge($allShortcodeTags, $shortcodeTags);
33
            }
34 2
35 2
            $container
36
                ->getDefinition(GuideController::class)
37 8
                ->setArgument(0, $allShortcodeTags);
38
        }
39
    }
40
}
41