Completed
Pull Request — master (#253)
by
unknown
12:46
created

LiipFunctionalTestExtension.php (1 issue)

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 4
    public function load(array $configs, ContainerBuilder $container)
28
    {
29 4
        $config = $this->processConfiguration(new Configuration(), $configs);
30
31 4
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
32 4
        $loader->load('functional_test.xml');
33 4
        if (interface_exists('Symfony\Component\Validator\Validator\ValidatorInterface')) {
34 4
            $loader->load('validator.xml');
35 4
        }
36
37 4
        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 4
            if (is_array($value)) {
45 4
                foreach ($value as $key2 => $value2) {
46 4
                    $container->setParameter($this->getAlias().'.'.$key.
47 4
                        '.'.$key2, $value2);
48 4
                }
49 4
            } else {
50 4
                $container->setParameter($this->getAlias().'.'.$key, $value);
51
            }
52 4
        }
53
54 4
        $definition = $container->getDefinition('liip_functional_test.query.count_client');
55 4
        if (method_exists($definition, 'setShared')) {
56 4
            $definition->setShared(false);
57 4
        } else {
58
            // This block will never be reached with Symfony <2.8
59
            // @codeCoverageIgnoreStart
60
            $definition->setScope('prototype');
0 ignored issues
show
Deprecated Code introduced by
The method Symfony\Component\Depend...\Definition::setScope() has been deprecated with message: since version 2.8, to be removed in 3.0.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

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