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
Pull Request — master (#391)
by
unknown
32:21
created

HautelookAliceExtension   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 7
dl 0
loc 70
ccs 37
cts 37
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A loadConfig() 0 12 2
A load() 0 22 3
A loadServices() 0 13 2
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 Faker\Provider\Base;
15
use Hautelook\AliceBundle\HautelookAliceBundle;
16
use LogicException;
17
use Symfony\Component\Config\FileLocator;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
20
use Symfony\Component\Finder\Finder;
21
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
22
23
/**
24
 * @private
25
 *
26
 * @author Baldur Rensch <[email protected]>
27
 * @author Théo FIDRY <[email protected]>
28
 */
29
final class HautelookAliceExtension extends Extension
30
{
31
    const SERVICES_DIR = __DIR__.'/../../resources/config';
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function load(array $configs, ContainerBuilder $container)
37
    {
38
        $bundles = array_flip($container->getParameter('kernel.bundles'));
39
40 27
        if (false === array_key_exists('Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle', $bundles)) {
41
            throw new LogicException(
42 27
                sprintf(
43 27
                    'Cannot register "%s" without "Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle".',
44 27
                    HautelookAliceBundle::class
45 27
                )
46
            );
47
        }
48
49
        $this->loadConfig($configs, $container);
50
        $this->loadServices($container);
51
52 27
        // Register autoconfiguration rules for Symfony DI 3.3+
53
        if (method_exists($container, 'registerForAutoconfiguration')) {
54 27
            $container->registerForAutoconfiguration(Base::class)
55 27
                ->addTag('nelmio_alice.faker.provider');
56
        }
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
90 24
        $finder->files()->in(self::SERVICES_DIR);
91 24
92
        foreach ($finder as $file) {
93 15
            $loader->load(
94
                $file->getRelativePathname()
95
            );
96
        }
97 15
    }
98
}
99