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 (#1)
by Pascal
02:45
created

ApiBundleExtension   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 70
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A loadConfiguration() 0 5 1
A loadServices() 0 4 1
A getConfiguration() 0 3 1
A load() 0 7 1
A getAlias() 0 3 1
A configureResponseListenerDefaultContentType() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Saikootau\ApiBundle\DependencyInjection;
6
7
use Symfony\Component\Config\FileLocator;
8
use Symfony\Component\DependencyInjection\Extension\Extension;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
11
12
class ApiBundleExtension extends Extension
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17 1
    public function getAlias(): string
18
    {
19 1
        return 'saikootau_api';
20
    }
21
22
    /**
23
     * @param array            $config
24
     * @param ContainerBuilder $container
25
     *
26
     * @return Configuration
27
     */
28 1
    public function getConfiguration(array $config, ContainerBuilder $container): Configuration
29
    {
30 1
        return new Configuration();
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 1
    public function load(array $configs, ContainerBuilder $container): void
37
    {
38 1
        $this->loadServices($container);
39
40 1
        $configs = $this->loadConfiguration($configs, $container);
41 1
        $this->configureResponseListenerDefaultContentType('saikootau_api.event.listener.resource_response', $configs, $container);
42 1
        $this->configureResponseListenerDefaultContentType('saikootau_api.event.listener.exception_response', $configs, $container);
43 1
    }
44
45
    /**
46
     * Load the service configuration.
47
     *
48
     * @param ContainerBuilder $container
49
     */
50 1
    private function loadServices(ContainerBuilder $container): void
51
    {
52 1
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/..'));
53 1
        $loader->load('Resources/config/services.xml');
54 1
    }
55
56
    /**
57
     * Load the bundle configuration. Returns the normalized config.
58
     *
59
     * @param array            $configs
60
     * @param ContainerBuilder $container
61
     *
62
     * @return array
63
     */
64 1
    private function loadConfiguration(array $configs, ContainerBuilder $container): array
65
    {
66 1
        $configuration = $this->getConfiguration($configs, $container);
67
68 1
        return $this->processConfiguration($configuration, $configs);
69
    }
70
71
    /**
72
     * Set the default content type for given response listener service.
73
     *
74
     * @param string $serviceId
75
     * @param array $configs
76
     * @param ContainerBuilder $container
77
     */
78 1
    private function configureResponseListenerDefaultContentType(string $serviceId, array $configs, ContainerBuilder $container): void
79
    {
80 1
        $responseListener = $container->getDefinition($serviceId);
81 1
        $responseListener->setArgument(1, $configs['default_content_type']);
82 1
    }
83
}
84