3 use Symfony\Component\DependencyInjection\ContainerInterface;
4 use Symfony\Component\DependencyInjection\Container;
5 use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
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 * ProjectServiceContainer.
14 * This class has been auto-generated
15 * by the Symfony Dependency Injection Component.
17 class ProjectServiceContainer extends Container
20 private $targetDirs = array();
25 public function __construct()
27 $this->parameters = $this->getDefaultParameters();
30 $this->scopedServices =
31 $this->scopeStacks = array();
32 $this->scopes = array();
33 $this->scopeChildren = array();
34 $this->methodMap = array(
35 'bar' => 'getBarService',
36 'baz' => 'getBazService',
37 'configured_service' => 'getConfiguredServiceService',
38 'decorator_service' => 'getDecoratorServiceService',
39 'decorator_service_with_name' => 'getDecoratorServiceWithNameService',
40 'deprecated_service' => 'getDeprecatedServiceService',
41 'factory_service' => 'getFactoryServiceService',
42 'foo' => 'getFooService',
43 'foo.baz' => 'getFoo_BazService',
44 'foo_bar' => 'getFooBarService',
45 'foo_with_inline' => 'getFooWithInlineService',
46 'method_call1' => 'getMethodCall1Service',
47 'new_factory_service' => 'getNewFactoryServiceService',
48 'request' => 'getRequestService',
49 'service_from_static_method' => 'getServiceFromStaticMethodService',
51 $this->aliases = array(
52 'alias_for_alias' => 'foo',
53 'alias_for_foo' => 'foo',
54 'decorated' => 'decorator_service_with_name',
61 public function compile()
63 throw new LogicException('You cannot compile a dumped frozen container.');
69 public function isFrozen()
75 * Gets the 'bar' service.
77 * This service is shared.
78 * This method always returns the same instance of the service.
80 * @return \Bar\FooClass A Bar\FooClass instance
82 protected function getBarService()
84 $a = $this->get('foo.baz');
86 $this->services['bar'] = $instance = new \Bar\FooClass('foo', $a, $this->getParameter('foo_bar'));
88 $a->configure($instance);
94 * Gets the 'baz' service.
96 * This service is shared.
97 * This method always returns the same instance of the service.
99 * @return \Baz A Baz instance
101 protected function getBazService()
103 $this->services['baz'] = $instance = new \Baz();
105 $instance->setFoo($this->get('foo_with_inline'));
111 * Gets the 'configured_service' service.
113 * This service is shared.
114 * This method always returns the same instance of the service.
116 * @return \stdClass A stdClass instance
118 protected function getConfiguredServiceService()
120 $a = new \ConfClass();
121 $a->setFoo($this->get('baz'));
123 $this->services['configured_service'] = $instance = new \stdClass();
125 $a->configureStdClass($instance);
131 * Gets the 'decorator_service' service.
133 * This service is shared.
134 * This method always returns the same instance of the service.
136 * @return \stdClass A stdClass instance
138 protected function getDecoratorServiceService()
140 return $this->services['decorator_service'] = new \stdClass();
144 * Gets the 'decorator_service_with_name' service.
146 * This service is shared.
147 * This method always returns the same instance of the service.
149 * @return \stdClass A stdClass instance
151 protected function getDecoratorServiceWithNameService()
153 return $this->services['decorator_service_with_name'] = new \stdClass();
157 * Gets the 'deprecated_service' service.
159 * This service is shared.
160 * This method always returns the same instance of the service.
162 * @return \stdClass A stdClass instance
164 * @deprecated The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.
166 protected function getDeprecatedServiceService()
168 @trigger_error('The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.', E_USER_DEPRECATED);
170 return $this->services['deprecated_service'] = new \stdClass();
174 * Gets the 'factory_service' service.
176 * This service is shared.
177 * This method always returns the same instance of the service.
179 * @return \Bar A Bar instance
181 protected function getFactoryServiceService()
183 return $this->services['factory_service'] = $this->get('foo.baz')->getInstance();
187 * Gets the 'foo' service.
189 * This service is shared.
190 * This method always returns the same instance of the service.
192 * @return \Bar\FooClass A Bar\FooClass instance
194 protected function getFooService()
196 $a = $this->get('foo.baz');
198 $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this);
200 $instance->foo = 'bar';
202 $instance->qux = array('bar' => 'foo is bar', 'foobar' => 'bar');
203 $instance->setBar($this->get('bar'));
204 $instance->initialize();
205 sc_configure($instance);
211 * Gets the 'foo.baz' service.
213 * This service is shared.
214 * This method always returns the same instance of the service.
216 * @return \BazClass A BazClass instance
218 protected function getFoo_BazService()
220 $this->services['foo.baz'] = $instance = \BazClass::getInstance();
222 \BazClass::configureStatic1($instance);
228 * Gets the 'foo_bar' service.
230 * @return \Bar\FooClass A Bar\FooClass instance
232 protected function getFooBarService()
234 return new \Bar\FooClass();
238 * Gets the 'foo_with_inline' service.
240 * This service is shared.
241 * This method always returns the same instance of the service.
243 * @return \Foo A Foo instance
245 protected function getFooWithInlineService()
249 $this->services['foo_with_inline'] = $instance = new \Foo();
252 $a->setBaz($this->get('baz'));
254 $instance->setBar($a);
260 * Gets the 'method_call1' service.
262 * This service is shared.
263 * This method always returns the same instance of the service.
265 * @return \Bar\FooClass A Bar\FooClass instance
267 protected function getMethodCall1Service()
269 require_once '%path%foo.php';
271 $this->services['method_call1'] = $instance = new \Bar\FooClass();
273 $instance->setBar($this->get('foo'));
274 $instance->setBar(NULL);
275 $instance->setBar(($this->get("foo")->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default"))));
281 * Gets the 'new_factory_service' service.
283 * This service is shared.
284 * This method always returns the same instance of the service.
286 * @return \FooBarBaz A FooBarBaz instance
288 protected function getNewFactoryServiceService()
290 $a = new \FactoryClass();
293 $this->services['new_factory_service'] = $instance = $a->getInstance();
295 $instance->foo = 'bar';
301 * Gets the 'request' service.
303 * This service is shared.
304 * This method always returns the same instance of the service.
306 * @throws RuntimeException always since this service is expected to be injected dynamically
308 protected function getRequestService()
310 throw new RuntimeException('You have requested a synthetic service ("request"). The DIC does not know how to construct this service.');
314 * Gets the 'service_from_static_method' service.
316 * This service is shared.
317 * This method always returns the same instance of the service.
319 * @return \Bar\FooClass A Bar\FooClass instance
321 protected function getServiceFromStaticMethodService()
323 return $this->services['service_from_static_method'] = \Bar\FooClass::getInstance();
329 public function getParameter($name)
331 $name = strtolower($name);
333 if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters))) {
334 throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
337 return $this->parameters[$name];
343 public function hasParameter($name)
345 $name = strtolower($name);
347 return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters);
353 public function setParameter($name, $value)
355 throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
361 public function getParameterBag()
363 if (null === $this->parameterBag) {
364 $this->parameterBag = new FrozenParameterBag($this->parameters);
367 return $this->parameterBag;
371 * Gets the default parameters.
373 * @return array An array of the default parameters
375 protected function getDefaultParameters()
378 'baz_class' => 'BazClass',
379 'foo_class' => 'Bar\\FooClass',