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;
12 * This class has been auto-generated
13 * by the Symfony Dependency Injection Component.
15 * @final since Symfony 3.3
17 class ProjectServiceContainer extends Container
20 private $targetDirs = array();
22 public function __construct()
24 $this->parameters = $this->getDefaultParameters();
26 $this->services = array();
27 $this->syntheticIds = array(
30 $this->methodMap = array(
31 'bar' => 'getBarService',
32 'baz' => 'getBazService',
33 'configured_service' => 'getConfiguredServiceService',
34 'configured_service_simple' => 'getConfiguredServiceSimpleService',
35 'decorator_service' => 'getDecoratorServiceService',
36 'decorator_service_with_name' => 'getDecoratorServiceWithNameService',
37 'deprecated_service' => 'getDeprecatedServiceService',
38 'factory_service' => 'getFactoryServiceService',
39 'factory_service_simple' => 'getFactoryServiceSimpleService',
40 'factory_simple' => 'getFactorySimpleService',
41 'foo' => 'getFooService',
42 'foo.baz' => 'getFoo_BazService',
43 'foo_bar' => 'getFooBarService',
44 'foo_with_inline' => 'getFooWithInlineService',
45 'lazy_context' => 'getLazyContextService',
46 'lazy_context_ignore_invalid_ref' => 'getLazyContextIgnoreInvalidRefService',
47 'method_call1' => 'getMethodCall1Service',
48 'new_factory_service' => 'getNewFactoryServiceService',
49 'service_from_static_method' => 'getServiceFromStaticMethodService',
50 'tagged_iterator' => 'getTaggedIteratorService',
51 'tagged_iterator_foo' => 'getTaggedIteratorFooService',
53 $this->privates = array(
54 'factory_simple' => true,
55 'tagged_iterator_foo' => true,
57 $this->aliases = array(
58 'alias_for_alias' => 'foo',
59 'alias_for_foo' => 'foo',
60 'decorated' => 'decorator_service_with_name',
64 public function getRemovedIds()
67 'Psr\\Container\\ContainerInterface' => true,
68 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
69 'configurator_service' => true,
70 'configurator_service_simple' => true,
71 'decorated.pif-pouf' => true,
72 'decorator_service.inner' => true,
73 'factory_simple' => true,
75 'new_factory' => true,
76 'tagged_iterator_foo' => true,
80 public function compile()
82 throw new LogicException('You cannot compile a dumped container that was already compiled.');
85 public function isCompiled()
90 public function isFrozen()
92 @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);
98 * Gets the public 'bar' shared service.
100 * @return \Bar\FooClass
102 protected function getBarService()
104 $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'};
106 $this->services['bar'] = $instance = new \Bar\FooClass('foo', $a, $this->getParameter('foo_bar'));
108 $a->configure($instance);
114 * Gets the public 'baz' shared service.
118 protected function getBazService()
120 $this->services['baz'] = $instance = new \Baz();
122 $instance->setFoo(${($_ = isset($this->services['foo_with_inline']) ? $this->services['foo_with_inline'] : $this->getFooWithInlineService()) && false ?: '_'});
128 * Gets the public 'configured_service' shared service.
132 protected function getConfiguredServiceService()
134 $this->services['configured_service'] = $instance = new \stdClass();
136 $a = new \ConfClass();
137 $a->setFoo(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->getBazService()) && false ?: '_'});
139 $a->configureStdClass($instance);
145 * Gets the public 'configured_service_simple' shared service.
149 protected function getConfiguredServiceSimpleService()
151 $this->services['configured_service_simple'] = $instance = new \stdClass();
153 (new \ConfClass('bar'))->configureStdClass($instance);
159 * Gets the public 'decorator_service' shared service.
163 protected function getDecoratorServiceService()
165 return $this->services['decorator_service'] = new \stdClass();
169 * Gets the public 'decorator_service_with_name' shared service.
173 protected function getDecoratorServiceWithNameService()
175 return $this->services['decorator_service_with_name'] = new \stdClass();
179 * Gets the public 'deprecated_service' shared service.
183 * @deprecated The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.
185 protected function getDeprecatedServiceService()
187 @trigger_error('The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.', E_USER_DEPRECATED);
189 return $this->services['deprecated_service'] = new \stdClass();
193 * Gets the public 'factory_service' shared service.
197 protected function getFactoryServiceService()
199 return $this->services['factory_service'] = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}->getInstance();
203 * Gets the public 'factory_service_simple' shared service.
207 protected function getFactoryServiceSimpleService()
209 return $this->services['factory_service_simple'] = ${($_ = isset($this->services['factory_simple']) ? $this->services['factory_simple'] : $this->getFactorySimpleService()) && false ?: '_'}->getInstance();
213 * Gets the public 'foo' shared service.
215 * @return \Bar\FooClass
217 protected function getFooService()
219 $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'};
221 $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this);
223 $instance->foo = 'bar';
225 $instance->qux = array('bar' => 'foo is bar', 'foobar' => 'bar');
226 $instance->setBar(${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && false ?: '_'});
227 $instance->initialize();
228 sc_configure($instance);
234 * Gets the public 'foo.baz' shared service.
238 protected function getFoo_BazService()
240 $this->services['foo.baz'] = $instance = \BazClass::getInstance();
242 \BazClass::configureStatic1($instance);
248 * Gets the public 'foo_bar' service.
250 * @return \Bar\FooClass
252 protected function getFooBarService()
254 return new \Bar\FooClass(${($_ = isset($this->services['deprecated_service']) ? $this->services['deprecated_service'] : $this->getDeprecatedServiceService()) && false ?: '_'});
258 * Gets the public 'foo_with_inline' shared service.
262 protected function getFooWithInlineService()
264 $this->services['foo_with_inline'] = $instance = new \Foo();
269 $a->setBaz(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->getBazService()) && false ?: '_'});
271 $instance->setBar($a);
277 * Gets the public 'lazy_context' shared service.
279 * @return \LazyContext
281 protected function getLazyContextService()
283 return $this->services['lazy_context'] = new \LazyContext(new RewindableGenerator(function () {
284 yield 'k1' => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'};
286 }, 2), new RewindableGenerator(function () {
287 return new \EmptyIterator();
292 * Gets the public 'lazy_context_ignore_invalid_ref' shared service.
294 * @return \LazyContext
296 protected function getLazyContextIgnoreInvalidRefService()
298 return $this->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(function () {
299 yield 0 => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'};
300 }, 1), new RewindableGenerator(function () {
301 return new \EmptyIterator();
306 * Gets the public 'method_call1' shared service.
308 * @return \Bar\FooClass
310 protected function getMethodCall1Service()
312 include_once '%path%foo.php';
314 $this->services['method_call1'] = $instance = new \Bar\FooClass();
316 $instance->setBar(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'});
317 $instance->setBar(NULL);
318 $instance->setBar((${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default"))));
324 * Gets the public 'new_factory_service' shared service.
328 protected function getNewFactoryServiceService()
330 $a = new \FactoryClass();
333 $this->services['new_factory_service'] = $instance = $a->getInstance();
335 $instance->foo = 'bar';
341 * Gets the public 'service_from_static_method' shared service.
343 * @return \Bar\FooClass
345 protected function getServiceFromStaticMethodService()
347 return $this->services['service_from_static_method'] = \Bar\FooClass::getInstance();
351 * Gets the public 'tagged_iterator' shared service.
355 protected function getTaggedIteratorService()
357 return $this->services['tagged_iterator'] = new \Bar(new RewindableGenerator(function () {
358 yield 0 => ${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'};
359 yield 1 => ${($_ = isset($this->services['tagged_iterator_foo']) ? $this->services['tagged_iterator_foo'] : $this->services['tagged_iterator_foo'] = new \Bar()) && false ?: '_'};
364 * Gets the private 'factory_simple' shared service.
366 * @return \SimpleFactoryClass
368 * @deprecated The "factory_simple" service is deprecated. You should stop using it, as it will soon be removed.
370 protected function getFactorySimpleService()
372 @trigger_error('The "factory_simple" service is deprecated. You should stop using it, as it will soon be removed.', E_USER_DEPRECATED);
374 return $this->services['factory_simple'] = new \SimpleFactoryClass('foo');
378 * Gets the private 'tagged_iterator_foo' shared service.
382 protected function getTaggedIteratorFooService()
384 return $this->services['tagged_iterator_foo'] = new \Bar();
387 public function getParameter($name)
389 $name = (string) $name;
390 if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
391 $name = $this->normalizeParameterName($name);
393 if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
394 throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
397 if (isset($this->loadedDynamicParameters[$name])) {
398 return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
401 return $this->parameters[$name];
404 public function hasParameter($name)
406 $name = (string) $name;
407 $name = $this->normalizeParameterName($name);
409 return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters);
412 public function setParameter($name, $value)
414 throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
417 public function getParameterBag()
419 if (null === $this->parameterBag) {
420 $parameters = $this->parameters;
421 foreach ($this->loadedDynamicParameters as $name => $loaded) {
422 $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
424 $this->parameterBag = new FrozenParameterBag($parameters);
427 return $this->parameterBag;
430 private $loadedDynamicParameters = array();
431 private $dynamicParameters = array();
434 * Computes a dynamic parameter.
436 * @param string The name of the dynamic parameter to load
438 * @return mixed The value of the dynamic parameter
440 * @throws InvalidArgumentException When the dynamic parameter does not exist
442 private function getDynamicParameter($name)
444 throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name));
447 private $normalizedParameterNames = array();
449 private function normalizeParameterName($name)
451 if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) {
452 $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName;
453 if ((string) $name !== $normalizedName) {
454 @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);
457 $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name;
460 return $normalizedName;
464 * Gets the default parameters.
466 * @return array An array of the default parameters
468 protected function getDefaultParameters()
471 'baz_class' => 'BazClass',
472 'foo_class' => 'Bar\\FooClass',