Yaffs site version 1.1
[yaffs-website] / vendor / symfony / dependency-injection / ParameterBag / FrozenParameterBag.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\ParameterBag;
13
14 use Symfony\Component\DependencyInjection\Exception\LogicException;
15
16 /**
17  * Holds read-only parameters.
18  *
19  * @author Fabien Potencier <fabien@symfony.com>
20  */
21 class FrozenParameterBag extends ParameterBag
22 {
23     /**
24      * For performance reasons, the constructor assumes that
25      * all keys are already lowercased.
26      *
27      * This is always the case when used internally.
28      *
29      * @param array $parameters An array of parameters
30      */
31     public function __construct(array $parameters = array())
32     {
33         $this->parameters = $parameters;
34         $this->resolved = true;
35     }
36
37     /**
38      * {@inheritdoc}
39      */
40     public function clear()
41     {
42         throw new LogicException('Impossible to call clear() on a frozen ParameterBag.');
43     }
44
45     /**
46      * {@inheritdoc}
47      */
48     public function add(array $parameters)
49     {
50         throw new LogicException('Impossible to call add() on a frozen ParameterBag.');
51     }
52
53     /**
54      * {@inheritdoc}
55      */
56     public function set($name, $value)
57     {
58         throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
59     }
60
61     /**
62      * {@inheritdoc}
63      */
64     public function remove($name)
65     {
66         throw new LogicException('Impossible to call remove() on a frozen ParameterBag.');
67     }
68 }