Completed
Push — master ( f2d7cc...c90f48 )
by Robert
04:06
created

MediaMonksRestApiExtension::getDebug()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace MediaMonks\RestApiBundle\DependencyInjection;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
8
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
9
use Symfony\Component\DependencyInjection\Loader;
10
11
/**
12
 * This is the class that loads and manages your bundle configuration.
13
 *
14
 * @link http://symfony.com/doc/current/cookbook/bundles/extension.html
15
 */
16
class MediaMonksRestApiExtension extends Extension implements ExtensionInterface
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21 3
    public function load(array $configs, ContainerBuilder $container)
22
    {
23 3
        $config = $this->processConfiguration(new Configuration(), $configs);
24
25 3
        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
26 3
        $loader->load('services.xml');
27
28 3
        $container->getDefinition('mediamonks_rest_api.request_matcher')
29 3
            ->replaceArgument(0, $config['request_matcher']['whitelist']);
30 3
        $container->getDefinition('mediamonks_rest_api.request_matcher')
31 3
            ->replaceArgument(1, $config['request_matcher']['blacklist']);
32
33 3
        $container->getDefinition('mediamonks_rest_api.request_transformer')
34 3
            ->replaceArgument(0, $config['output_formats']);
35
36 3
        $container->getDefinition('mediamonks_rest_api.response_transformer')
37 3
            ->replaceArgument(2, [
38 3
                'debug'               => $this->getDebug($container, $config),
0 ignored issues
show
Unused Code introduced by
The call to MediaMonksRestApiExtension::getDebug() has too many arguments starting with $config.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
39 3
                'post_message_origin' => $config['post_message_origin']
40 3
            ]);
41 3
    }
42
43
    /**
44
     * @return string
45
     */
46 3
    public function getAlias()
47
    {
48 3
        return 'mediamonks_rest_api';
49
    }
50
51
    /**
52
     * @param ContainerBuilder $container
53
     * @return bool
54
     */
55 3
    public function getDebug(ContainerBuilder $container)
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
56
    {
57 3
        return true;
58
    }
59
}
60