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.

Core23SitemapExtension::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 2
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
    public function load(array $configs, ContainerBuilder $container): void
24
    {
25
        $configuration = new Configuration();
26
        $config        = $this->processConfiguration($configuration, $configs);
27
28
        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
29
        $loader->load('action.xml');
30
        $loader->load('services.xml');
31
        $loader->load('sitemap.xml');
32
33
        $this->configureCache($container, $config);
34
        $this->configureStaticUrls($container, $config);
35
    }
36
37
    private function configureCache(ContainerBuilder $container, array $config): void
38
    {
39
        if (null === $config['cache']['service']) {
40
            return;
41
        }
42
43
        $container->getDefinition(SitemapGenerator::class)
44
            ->replaceArgument(2, new Reference($config['cache']['service']))
45
        ;
46
    }
47
48
    private function configureStaticUrls(ContainerBuilder $container, array $config): void
49
    {
50
        $container->setParameter('core23_sitemap.static_urls', $config['static']);
51
    }
52
}
53