56e2a98cc5e0ff9bcb58a243df722914d082c866
[yaffs-website] / vendor / symfony / dependency-injection / Tests / Fixtures / php / services8.php
1 <?php
2
3 use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
4 use Symfony\Component\DependencyInjection\ContainerInterface;
5 use Symfony\Component\DependencyInjection\Container;
6 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
7 use Symfony\Component\DependencyInjection\Exception\LogicException;
8 use Symfony\Component\DependencyInjection\Exception\RuntimeException;
9 use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
10
11 /**
12  * This class has been auto-generated
13  * by the Symfony Dependency Injection Component.
14  *
15  * @final since Symfony 3.3
16  */
17 class ProjectServiceContainer extends Container
18 {
19     private $parameters;
20     private $targetDirs = array();
21
22     public function __construct()
23     {
24         $this->parameters = $this->getDefaultParameters();
25
26         $this->services = array();
27
28         $this->aliases = array();
29     }
30
31     public function getRemovedIds()
32     {
33         return array(
34             'Psr\\Container\\ContainerInterface' => true,
35             'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
36         );
37     }
38
39     public function compile()
40     {
41         throw new LogicException('You cannot compile a dumped container that was already compiled.');
42     }
43
44     public function isCompiled()
45     {
46         return true;
47     }
48
49     public function isFrozen()
50     {
51         @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED);
52
53         return true;
54     }
55
56     public function getParameter($name)
57     {
58         $name = (string) $name;
59         if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
60             $name = $this->normalizeParameterName($name);
61
62             if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
63                 throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
64             }
65         }
66         if (isset($this->loadedDynamicParameters[$name])) {
67             return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
68         }
69
70         return $this->parameters[$name];
71     }
72
73     public function hasParameter($name)
74     {
75         $name = (string) $name;
76         $name = $this->normalizeParameterName($name);
77
78         return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters);
79     }
80
81     public function setParameter($name, $value)
82     {
83         throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
84     }
85
86     public function getParameterBag()
87     {
88         if (null === $this->parameterBag) {
89             $parameters = $this->parameters;
90             foreach ($this->loadedDynamicParameters as $name => $loaded) {
91                 $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
92             }
93             $this->parameterBag = new FrozenParameterBag($parameters);
94         }
95
96         return $this->parameterBag;
97     }
98
99     private $loadedDynamicParameters = array();
100     private $dynamicParameters = array();
101
102     /**
103      * Computes a dynamic parameter.
104      *
105      * @param string The name of the dynamic parameter to load
106      *
107      * @return mixed The value of the dynamic parameter
108      *
109      * @throws InvalidArgumentException When the dynamic parameter does not exist
110      */
111     private function getDynamicParameter($name)
112     {
113         throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name));
114     }
115
116     private $normalizedParameterNames = array();
117
118     private function normalizeParameterName($name)
119     {
120         if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) {
121             $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName;
122             if ((string) $name !== $normalizedName) {
123                 @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED);
124             }
125         } else {
126             $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name;
127         }
128
129         return $normalizedName;
130     }
131
132     /**
133      * Gets the default parameters.
134      *
135      * @return array An array of the default parameters
136      */
137     protected function getDefaultParameters()
138     {
139         return array(
140             'foo' => 'bar',
141             'baz' => 'bar',
142             'bar' => 'foo is %foo bar',
143             'escape' => '@escapeme',
144             'values' => array(
145                 0 => true,
146                 1 => false,
147                 2 => NULL,
148                 3 => 0,
149                 4 => 1000.3,
150                 5 => 'true',
151                 6 => 'false',
152                 7 => 'null',
153             ),
154         );
155     }
156 }