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.

StrontiumPjaxExtension::prepend()   B
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 24
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 7
Bugs 2 Features 0
Metric Value
c 7
b 2
f 0
dl 0
loc 24
rs 8.9713
cc 2
eloc 14
nc 2
nop 1
1
<?php
2
3
namespace Strontium\PjaxBundle\DependencyInjection;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
8
use Symfony\Component\DependencyInjection\Loader;
9
use Symfony\Component\DependencyInjection\Reference;
10
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
11
12
/**
13
 * {@inheritdoc}
14
 */
15
class StrontiumPjaxExtension extends Extension implements PrependExtensionInterface
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function load(array $configs, ContainerBuilder $container)
21
    {
22
        $config = $this->processConfiguration(new Configuration(), $configs);
23
24
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
25
        $loader->load('services.yml');
26
27
        $container
28
            ->getDefinition('pjax.twig.extension')
29
            ->addMethodCall('setSections', [$config['sections']]);
30
31
        if ($config['add_content_version'] === true && $config['version_generator']) {
32
            $container
33
                ->getDefinition('pjax.helper')
34
                ->addMethodCall('setVersionGenerator', [new Reference($config['version_generator'])]);
35
36
            $container
37
                ->getDefinition('pjax.kernel.event_listener.response')
38
                ->addTag('kernel.event_listener', [
39
                    'event'  => 'kernel.response',
40
                    'method' => 'addPjaxVersion'
41
                ]);
42
        }
43
        if ($config['menu']) {
44
            $loader->load('menu.yml');
45
        }
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function prepend(ContainerBuilder $container)
52
    {
53
        $input = [
54
            '@StrontiumPjaxBundle/Resources/public/js/dom-initializer.js',
55
            '@StrontiumPjaxBundle/Resources/public/js/pjax.js',
56
            '@StrontiumPjaxBundle/Resources/public/js/modal.js',
57
            '@StrontiumPjaxBundle/Resources/public/js/flash.js',
58
        ];
59
60
        $configs = $container->getExtensionConfig($this->getAlias());
61
        $config = $this->processConfiguration(new Configuration(), $configs);
62
        if ($config['menu']) {
63
            $input[] = '@StrontiumPjaxBundle/Resources/public/js/menu.js';
64
        }
65
66
67
        $container->prependExtensionConfig('assetic', [
68
            'assets' => [
69
                'pjax' => [
70
                    'input' => $input,
71
                ]
72
            ]
73
        ]);
74
    }
75
}
76