9585b1a4b5c34e6eed6f5df11130321ffe0de743
[yaffs-website] / vendor / symfony / dependency-injection / Loader / Configurator / ParametersConfigurator.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
13
14 use Symfony\Component\DependencyInjection\ContainerBuilder;
15
16 /**
17  * @author Nicolas Grekas <p@tchwork.com>
18  */
19 class ParametersConfigurator extends AbstractConfigurator
20 {
21     const FACTORY = 'parameters';
22
23     private $container;
24
25     public function __construct(ContainerBuilder $container)
26     {
27         $this->container = $container;
28     }
29
30     /**
31      * Creates a parameter.
32      *
33      * @param string $name
34      * @param mixed  $value
35      *
36      * @return $this
37      */
38     final public function set($name, $value)
39     {
40         $this->container->setParameter($name, static::processValue($value, true));
41
42         return $this;
43     }
44
45     /**
46      * Creates a parameter.
47      *
48      * @param string $name
49      * @param mixed  $value
50      *
51      * @return $this
52      */
53     final public function __invoke($name, $value)
54     {
55         return $this->set($name, $value);
56     }
57 }