Completed
Push — master ( 8050c4...8c5d97 )
by Lukas Kahwe
08:34
created

LiipFunctionalTestExtension.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * This file is part of the Liip/FunctionalTestBundle
5
 *
6
 * (c) Lukas Kahwe Smith <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Liip\FunctionalTestBundle\DependencyInjection;
13
14
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
15
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\Config\FileLocator;
18
19
class LiipFunctionalTestExtension extends Extension
20
{
21
    /**
22
     * Loads the services based on your application configuration.
23
     *
24
     * @param array            $configs
25
     * @param ContainerBuilder $container
26
     */
27 5
    public function load(array $configs, ContainerBuilder $container)
28
    {
29 5
        $config = $this->processConfiguration(new Configuration(), $configs);
30
31 5
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
32 5
        $loader->load('functional_test.xml');
33 5
        if (interface_exists('Symfony\Component\Validator\Validator\ValidatorInterface')) {
34 5
            $loader->load('validator.xml');
35 5
        }
36
37 5
        foreach ($config as $key => $value) {
38
            // If the node is an array,
39
            // e.g. "liip_functional_test.query.max_query_count",
40
            // set the value as
41
            // "liip_functional_test.query.max_query_count"
42
            // instead of an array "liip_functional_test.query"
43
            // with a "max_query_count" key.
44 5
            if (is_array($value)) {
45 5
                foreach ($value as $key2 => $value2) {
46 5
                    $container->setParameter($this->getAlias().'.'.$key.
47 5
                        '.'.$key2, $value2);
48 5
                }
49 5
            } else {
50 5
                $container->setParameter($this->getAlias().'.'.$key, $value);
51
            }
52 5
        }
53
54 5
        $definition = $container->getDefinition('liip_functional_test.query.count_client');
55 5
        if (method_exists($definition, 'setShared')) {
56 5
            $definition->setShared(false);
57 5
        } else {
58
            // This block will never be reached with Symfony <2.8
59
            // @codeCoverageIgnoreStart
60
            $definition->setScope('prototype');
0 ignored issues
show
The method setScope() does not seem to exist on object<Symfony\Component...cyInjection\Definition>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
61
            // @codeCoverageIgnoreEnd
62
        }
63 5
    }
64
}
65