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 ( be0626...df8c18 )
by Théo
33:01
created

HautelookAliceExtension::load()   B

Complexity

Conditions 3
Paths 3

Size

Total Lines 24
Code Lines 14

Duplication

Lines 16
Ratio 66.67 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 0
Metric Value
dl 16
loc 24
rs 8.9713
c 0
b 0
f 0
ccs 9
cts 9
cp 1
cc 3
eloc 14
nc 3
nop 2
crap 3
1
<?php
2
3
/*
4
 * This file is part of the Hautelook\AliceBundle package.
5
 *
6
 * (c) Baldur Rensch <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Hautelook\AliceBundle\DependencyInjection;
13
14
use Hautelook\AliceBundle\HautelookAliceBundle;
15
use Symfony\Component\Config\FileLocator;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
18
use Symfony\Component\Finder\Finder;
19
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
20
21
/**
22
 * @private
23
 *
24
 * @author Baldur Rensch <[email protected]>
25
 * @author Théo FIDRY <[email protected]>
26
 */
27
final class HautelookAliceExtension extends Extension
28
{
29
    const SERVICES_DIR = __DIR__.'/../../resources/config';
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function load(array $configs, ContainerBuilder $container)
35
    {
36
        $bundles = array_flip($container->getParameter('kernel.bundles'));
37
38 View Code Duplication
        if (false === array_key_exists('Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle', $bundles)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
            throw new \LogicException(
40 27
                sprintf(
41
                    'Cannot register "%s" without "Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle".',
42 27
                    HautelookAliceBundle::class
43 27
                )
44 27
            );
45 27
        }
46 View Code Duplication
        if (false === array_key_exists('Doctrine\Bundle\DoctrineBundle\DoctrineBundle', $bundles)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
47
            throw new \LogicException(
48
                sprintf(
49
                    'Cannot register "%s" without "Doctrine\Bundle\DoctrineBundle\DoctrineBundle".',
50
                    HautelookAliceBundle::class
51
                )
52 27
            );
53
        }
54 27
55 27
        $this->loadConfig($configs, $container);
56
        $this->loadServices($container);
57 24
    }
58 24
59 24
    /**
60
     * Loads alice configuration and add the configuration values to the application parameters.
61 24
     *
62 24
     * @param array            $configs
63
     * @param ContainerBuilder $container
64
     *
65
     * @throws \InvalidArgumentException
66 24
     */
67 24
    private function loadConfig(array $configs, ContainerBuilder $container)
68 16
    {
69 16
        $configuration = new Configuration();
70 8
        $processedConfiguration = $this->processConfiguration($configuration, $configs);
71 8
72
        foreach ($processedConfiguration as $key => $value) {
73
            $container->setParameter(
74 24
                $this->getAlias().'.'.$key,
75 24
                $value
76 24
            );
77 24
        }
78 15
    }
79
80 15
    /**
81 15
     * Loads all the services declarations.
82 15
     *
83 15
     * @param ContainerBuilder $container
84 15
     */
85
    private function loadServices(ContainerBuilder $container)
86 15
    {
87 24
        $loader = new XmlFileLoader($container, new FileLocator(self::SERVICES_DIR));
88
        $finder = new Finder();
89 24
        $finder->files()->in(self::SERVICES_DIR);
90 24
        foreach ($finder as $file) {
91 24
            $loader->load(
92
                $file->getRelativePathname()
93 15
            );
94
        }
95
    }
96
}
97