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.

ShortcodeCompilerPass   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 5

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
class ShortcodeCompilerPass implements CompilerPassInterface
15
{
16
    public function process(ContainerBuilder $container)
17
    {
18
        $shortcodeServices = $container->findTaggedServiceIds('webfactory.shortcode');
19
20
        // add services tagged with webfactory.shortcode as handlers to the short code handler container
21
        $handlerContainer = $container->findDefinition(HandlerContainer::class);
22
        foreach ($shortcodeServices as $id => $shortcodeTags) {
23
            foreach ($shortcodeTags as $shortcodeTag) {
24
                $handlerContainer->addMethodCall('add', [$shortcodeTag['shortcode'], new Reference($id)]);
25
            }
26
        }
27
28
        // prepare the GuideController if it's configuration is imported
29
        if ($container->has(GuideController::class)) {
30
            $allShortcodeTags = [];
31
            foreach ($shortcodeServices as $id => $shortcodeTags) {
32
                $allShortcodeTags = array_merge($allShortcodeTags, $shortcodeTags);
33
            }
34
35
            $container
36
                ->getDefinition(GuideController::class)
37
                ->setArgument(0, $allShortcodeTags);
38
        }
39
    }
40
}
41