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 ( b10e46...20af00 )
by Christian
263:11
created

Core23SitemapExtension   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 7
dl 0
loc 42
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 13 1
A configureCache() 0 9 2
A configureStaticUrls() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[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 Core23\SitemapBundle\DependencyInjection;
13
14
use Core23\SitemapBundle\Generator\SitemapGenerator;
15
use Symfony\Component\Config\FileLocator;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Loader;
18
use Symfony\Component\DependencyInjection\Reference;
19
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
20
21
final class Core23SitemapExtension extends Extension
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function load(array $configs, ContainerBuilder $container): void
27
    {
28
        $configuration = new Configuration();
29
        $config        = $this->processConfiguration($configuration, $configs);
30
31
        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
32
        $loader->load('action.xml');
33
        $loader->load('services.xml');
34
        $loader->load('sitemap.xml');
35
36
        $this->configureCache($container, $config);
37
        $this->configureStaticUrls($container, $config);
38
    }
39
40
    /**
41
     * @param ContainerBuilder $container
42
     * @param array            $config
43
     */
44
    private function configureCache(ContainerBuilder $container, array $config): void
45
    {
46
        if (null === $config['cache']['service']) {
47
            return;
48
        }
49
50
        $container->getDefinition(SitemapGenerator::class)
51
            ->replaceArgument(2, new Reference($config['cache']['service']));
52
    }
53
54
    /**
55
     * @param ContainerBuilder $container
56
     * @param array            $config
57
     */
58
    private function configureStaticUrls(ContainerBuilder $container, array $config): void
59
    {
60
        $container->setParameter('core23_sitemap.static_urls', $config['static']);
61
    }
62
}
63