9947d36ac54842da3b5186ce53fc5ecce053de58
[yaffs-website] / vendor / symfony / dependency-injection / Tests / Fixtures / php / services12.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         $dir = __DIR__;
25         for ($i = 1; $i <= 5; ++$i) {
26             $this->targetDirs[$i] = $dir = \dirname($dir);
27         }
28         $this->parameters = $this->getDefaultParameters();
29
30         $this->services = array();
31         $this->methodMap = array(
32             'test' => 'getTestService',
33         );
34
35         $this->aliases = array();
36     }
37
38     public function getRemovedIds()
39     {
40         return array(
41             'Psr\\Container\\ContainerInterface' => true,
42             'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
43         );
44     }
45
46     public function compile()
47     {
48         throw new LogicException('You cannot compile a dumped container that was already compiled.');
49     }
50
51     public function isCompiled()
52     {
53         return true;
54     }
55
56     public function isFrozen()
57     {
58         @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);
59
60         return true;
61     }
62
63     /**
64      * Gets the public 'test' shared service.
65      *
66      * @return \stdClass
67      */
68     protected function getTestService()
69     {
70         return $this->services['test'] = new \stdClass(('wiz'.$this->targetDirs[1]), array(('wiz'.$this->targetDirs[1]) => ($this->targetDirs[2].'/')));
71     }
72
73     public function getParameter($name)
74     {
75         $name = (string) $name;
76         if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
77             $name = $this->normalizeParameterName($name);
78
79             if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
80                 throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
81             }
82         }
83         if (isset($this->loadedDynamicParameters[$name])) {
84             return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
85         }
86
87         return $this->parameters[$name];
88     }
89
90     public function hasParameter($name)
91     {
92         $name = (string) $name;
93         $name = $this->normalizeParameterName($name);
94
95         return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters);
96     }
97
98     public function setParameter($name, $value)
99     {
100         throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
101     }
102
103     public function getParameterBag()
104     {
105         if (null === $this->parameterBag) {
106             $parameters = $this->parameters;
107             foreach ($this->loadedDynamicParameters as $name => $loaded) {
108                 $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
109             }
110             $this->parameterBag = new FrozenParameterBag($parameters);
111         }
112
113         return $this->parameterBag;
114     }
115
116     private $loadedDynamicParameters = array(
117         'foo' => false,
118         'buz' => false,
119     );
120     private $dynamicParameters = array();
121
122     /**
123      * Computes a dynamic parameter.
124      *
125      * @param string The name of the dynamic parameter to load
126      *
127      * @return mixed The value of the dynamic parameter
128      *
129      * @throws InvalidArgumentException When the dynamic parameter does not exist
130      */
131     private function getDynamicParameter($name)
132     {
133         switch ($name) {
134             case 'foo': $value = ('wiz'.$this->targetDirs[1]); break;
135             case 'buz': $value = $this->targetDirs[2]; break;
136             default: throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name));
137         }
138         $this->loadedDynamicParameters[$name] = true;
139
140         return $this->dynamicParameters[$name] = $value;
141     }
142
143     private $normalizedParameterNames = array();
144
145     private function normalizeParameterName($name)
146     {
147         if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) {
148             $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName;
149             if ((string) $name !== $normalizedName) {
150                 @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);
151             }
152         } else {
153             $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name;
154         }
155
156         return $normalizedName;
157     }
158
159     /**
160      * Gets the default parameters.
161      *
162      * @return array An array of the default parameters
163      */
164     protected function getDefaultParameters()
165     {
166         return array(
167             'bar' => __DIR__,
168             'baz' => (__DIR__.'/PhpDumperTest.php'),
169         );
170     }
171 }