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::process()   A
last analyzed

Complexity

Conditions 5
Paths 9

Size

Total Lines 22
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 12
nc 9
nop 1
dl 0
loc 22
rs 9.5555
c 0
b 0
f 0
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