ResponderExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAlias() 0 3 1
A load() 0 21 1
1
<?php
2
3
/**
4
 * This file is part of the bugloos/responder-bundle project.
5
 * (c) Bugloos <https://bugloos.com/>
6
 * For the full copyright and license information, please view
7
 * the LICENSE file that was distributed with this source code.
8
 */
9
10
namespace Bugloos\ResponderBundle\DependencyInjection;
11
12
use Symfony\Component\Config\FileLocator;
13
use Symfony\Component\DependencyInjection\ContainerBuilder;
14
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
15
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
16
17
/**
18
 * @author Mojtaba Gheytasi <[email protected]>
19
 */
20
class ResponderExtension extends Extension
21
{
22
    public function load(array $configs, ContainerBuilder $container)
23
    {
24
        $configuration = $this->getConfiguration($configs, $container);
25
        $config = $this->processConfiguration($configuration, $configs);
0 ignored issues
show
Bug introduced by
It seems like $configuration can also be of type null; however, parameter $configuration of Symfony\Component\Depend...:processConfiguration() does only seem to accept Symfony\Component\Config...\ConfigurationInterface, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
        $config = $this->processConfiguration(/** @scrutinizer ignore-type */ $configuration, $configs);
Loading history...
26
27
        $container->setParameter('default_max_items_per_page', $config['default_max_items_per_page']);
28
        $container->setParameter('default_items_per_page', $config['default_items_per_page']);
29
        $container->setParameter('page_key_in_request', $config['page_key_in_request']);
30
        $container->setParameter('items_per_page_key_in_request', $config['items_per_page_key_in_request']);
31
32
        $container->setAlias(
33
            'paginator_response',
34
            $config['paginator_response']
35
        )->setPublic(true);
36
37
        $loader = new YamlFileLoader(
38
            $container,
39
            new FileLocator(__DIR__.'/../Resources/config')
40
        );
41
42
        $loader->load('services.yaml');
43
    }
44
45
    public function getAlias(): string
46
    {
47
        return 'bugloos_responder';
48
    }
49
}
50