4680b6e853b9c8154af0d7d2ceae7f281db049d8
[yaffs-website] / vendor / symfony / dependency-injection / Tests / Fixtures / php / services9_compiled.php
1 <?php
2
3 use Symfony\Component\DependencyInjection\ContainerInterface;
4 use Symfony\Component\DependencyInjection\Container;
5 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
6 use Symfony\Component\DependencyInjection\Exception\LogicException;
7 use Symfony\Component\DependencyInjection\Exception\RuntimeException;
8 use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
9
10 /**
11  * ProjectServiceContainer.
12  *
13  * This class has been auto-generated
14  * by the Symfony Dependency Injection Component.
15  */
16 class ProjectServiceContainer extends Container
17 {
18     private $parameters;
19     private $targetDirs = array();
20
21     /**
22      * Constructor.
23      */
24     public function __construct()
25     {
26         $this->parameters = $this->getDefaultParameters();
27
28         $this->services = array();
29         $this->methodMap = array(
30             'bar' => 'getBarService',
31             'baz' => 'getBazService',
32             'configured_service' => 'getConfiguredServiceService',
33             'configured_service_simple' => 'getConfiguredServiceSimpleService',
34             'decorator_service' => 'getDecoratorServiceService',
35             'decorator_service_with_name' => 'getDecoratorServiceWithNameService',
36             'deprecated_service' => 'getDeprecatedServiceService',
37             'factory_service' => 'getFactoryServiceService',
38             'factory_service_simple' => 'getFactoryServiceSimpleService',
39             'foo' => 'getFooService',
40             'foo.baz' => 'getFoo_BazService',
41             'foo_bar' => 'getFooBarService',
42             'foo_with_inline' => 'getFooWithInlineService',
43             'method_call1' => 'getMethodCall1Service',
44             'new_factory_service' => 'getNewFactoryServiceService',
45             'request' => 'getRequestService',
46             'service_from_static_method' => 'getServiceFromStaticMethodService',
47         );
48         $this->aliases = array(
49             'alias_for_alias' => 'foo',
50             'alias_for_foo' => 'foo',
51             'decorated' => 'decorator_service_with_name',
52         );
53     }
54
55     /**
56      * {@inheritdoc}
57      */
58     public function compile()
59     {
60         throw new LogicException('You cannot compile a dumped frozen container.');
61     }
62
63     /**
64      * {@inheritdoc}
65      */
66     public function isFrozen()
67     {
68         return true;
69     }
70
71     /**
72      * Gets the public 'bar' shared service.
73      *
74      * @return \Bar\FooClass
75      */
76     protected function getBarService()
77     {
78         $a = $this->get('foo.baz');
79
80         $this->services['bar'] = $instance = new \Bar\FooClass('foo', $a, $this->getParameter('foo_bar'));
81
82         $a->configure($instance);
83
84         return $instance;
85     }
86
87     /**
88      * Gets the public 'baz' shared service.
89      *
90      * @return \Baz
91      */
92     protected function getBazService()
93     {
94         $this->services['baz'] = $instance = new \Baz();
95
96         $instance->setFoo($this->get('foo_with_inline'));
97
98         return $instance;
99     }
100
101     /**
102      * Gets the public 'configured_service' shared service.
103      *
104      * @return \stdClass
105      */
106     protected function getConfiguredServiceService()
107     {
108         $a = new \ConfClass();
109         $a->setFoo($this->get('baz'));
110
111         $this->services['configured_service'] = $instance = new \stdClass();
112
113         $a->configureStdClass($instance);
114
115         return $instance;
116     }
117
118     /**
119      * Gets the public 'configured_service_simple' shared service.
120      *
121      * @return \stdClass
122      */
123     protected function getConfiguredServiceSimpleService()
124     {
125         $this->services['configured_service_simple'] = $instance = new \stdClass();
126
127         (new \ConfClass('bar'))->configureStdClass($instance);
128
129         return $instance;
130     }
131
132     /**
133      * Gets the public 'decorator_service' shared service.
134      *
135      * @return \stdClass
136      */
137     protected function getDecoratorServiceService()
138     {
139         return $this->services['decorator_service'] = new \stdClass();
140     }
141
142     /**
143      * Gets the public 'decorator_service_with_name' shared service.
144      *
145      * @return \stdClass
146      */
147     protected function getDecoratorServiceWithNameService()
148     {
149         return $this->services['decorator_service_with_name'] = new \stdClass();
150     }
151
152     /**
153      * Gets the public 'deprecated_service' shared service.
154      *
155      * @return \stdClass
156      *
157      * @deprecated The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.
158      */
159     protected function getDeprecatedServiceService()
160     {
161         @trigger_error('The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.', E_USER_DEPRECATED);
162
163         return $this->services['deprecated_service'] = new \stdClass();
164     }
165
166     /**
167      * Gets the public 'factory_service' shared service.
168      *
169      * @return \Bar
170      */
171     protected function getFactoryServiceService()
172     {
173         return $this->services['factory_service'] = $this->get('foo.baz')->getInstance();
174     }
175
176     /**
177      * Gets the public 'factory_service_simple' shared service.
178      *
179      * @return \Bar
180      */
181     protected function getFactoryServiceSimpleService()
182     {
183         return $this->services['factory_service_simple'] = (new \SimpleFactoryClass('foo'))->getInstance();
184     }
185
186     /**
187      * Gets the public 'foo' shared service.
188      *
189      * @return \Bar\FooClass
190      */
191     protected function getFooService()
192     {
193         $a = $this->get('foo.baz');
194
195         $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this);
196
197         $instance->foo = 'bar';
198         $instance->moo = $a;
199         $instance->qux = array('bar' => 'foo is bar', 'foobar' => 'bar');
200         $instance->setBar($this->get('bar'));
201         $instance->initialize();
202         sc_configure($instance);
203
204         return $instance;
205     }
206
207     /**
208      * Gets the public 'foo.baz' shared service.
209      *
210      * @return \BazClass
211      */
212     protected function getFoo_BazService()
213     {
214         $this->services['foo.baz'] = $instance = \BazClass::getInstance();
215
216         \BazClass::configureStatic1($instance);
217
218         return $instance;
219     }
220
221     /**
222      * Gets the public 'foo_bar' service.
223      *
224      * @return \Bar\FooClass
225      */
226     protected function getFooBarService()
227     {
228         return new \Bar\FooClass();
229     }
230
231     /**
232      * Gets the public 'foo_with_inline' shared service.
233      *
234      * @return \Foo
235      */
236     protected function getFooWithInlineService()
237     {
238         $a = new \Bar();
239
240         $this->services['foo_with_inline'] = $instance = new \Foo();
241
242         $a->pub = 'pub';
243         $a->setBaz($this->get('baz'));
244
245         $instance->setBar($a);
246
247         return $instance;
248     }
249
250     /**
251      * Gets the public 'method_call1' shared service.
252      *
253      * @return \Bar\FooClass
254      */
255     protected function getMethodCall1Service()
256     {
257         require_once '%path%foo.php';
258
259         $this->services['method_call1'] = $instance = new \Bar\FooClass();
260
261         $instance->setBar($this->get('foo'));
262         $instance->setBar(NULL);
263         $instance->setBar(($this->get('foo')->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default"))));
264
265         return $instance;
266     }
267
268     /**
269      * Gets the public 'new_factory_service' shared service.
270      *
271      * @return \FooBarBaz
272      */
273     protected function getNewFactoryServiceService()
274     {
275         $a = new \FactoryClass();
276         $a->foo = 'bar';
277
278         $this->services['new_factory_service'] = $instance = $a->getInstance();
279
280         $instance->foo = 'bar';
281
282         return $instance;
283     }
284
285     /**
286      * Gets the public 'request' shared service.
287      *
288      * @throws RuntimeException always since this service is expected to be injected dynamically
289      */
290     protected function getRequestService()
291     {
292         throw new RuntimeException('You have requested a synthetic service ("request"). The DIC does not know how to construct this service.');
293     }
294
295     /**
296      * Gets the public 'service_from_static_method' shared service.
297      *
298      * @return \Bar\FooClass
299      */
300     protected function getServiceFromStaticMethodService()
301     {
302         return $this->services['service_from_static_method'] = \Bar\FooClass::getInstance();
303     }
304
305     /**
306      * {@inheritdoc}
307      */
308     public function getParameter($name)
309     {
310         $name = strtolower($name);
311
312         if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters) || isset($this->loadedDynamicParameters[$name]))) {
313             throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
314         }
315         if (isset($this->loadedDynamicParameters[$name])) {
316             return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
317         }
318
319         return $this->parameters[$name];
320     }
321
322     /**
323      * {@inheritdoc}
324      */
325     public function hasParameter($name)
326     {
327         $name = strtolower($name);
328
329         return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters) || isset($this->loadedDynamicParameters[$name]);
330     }
331
332     /**
333      * {@inheritdoc}
334      */
335     public function setParameter($name, $value)
336     {
337         throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
338     }
339
340     /**
341      * {@inheritdoc}
342      */
343     public function getParameterBag()
344     {
345         if (null === $this->parameterBag) {
346             $parameters = $this->parameters;
347             foreach ($this->loadedDynamicParameters as $name => $loaded) {
348                 $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
349             }
350             $this->parameterBag = new FrozenParameterBag($parameters);
351         }
352
353         return $this->parameterBag;
354     }
355
356     private $loadedDynamicParameters = array();
357     private $dynamicParameters = array();
358
359     /**
360      * Computes a dynamic parameter.
361      *
362      * @param string The name of the dynamic parameter to load
363      *
364      * @return mixed The value of the dynamic parameter
365      *
366      * @throws InvalidArgumentException When the dynamic parameter does not exist
367      */
368     private function getDynamicParameter($name)
369     {
370         throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name));
371     }
372
373     /**
374      * Gets the default parameters.
375      *
376      * @return array An array of the default parameters
377      */
378     protected function getDefaultParameters()
379     {
380         return array(
381             'baz_class' => 'BazClass',
382             'foo_class' => 'Bar\\FooClass',
383             'foo' => 'bar',
384         );
385     }
386 }