services9.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <?php
  2. use Symfony\Component\DependencyInjection\ContainerInterface;
  3. use Symfony\Component\DependencyInjection\Container;
  4. use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
  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\ParameterBag;
  9. /**
  10. * This class has been auto-generated
  11. * by the Symfony Dependency Injection Component.
  12. */
  13. class ProjectServiceContainer extends Container
  14. {
  15. private $parameters;
  16. private $targetDirs = array();
  17. public function __construct()
  18. {
  19. parent::__construct(new ParameterBag($this->getDefaultParameters()));
  20. $this->methodMap = array(
  21. 'bar' => 'getBarService',
  22. 'baz' => 'getBazService',
  23. 'configurator_service' => 'getConfiguratorServiceService',
  24. 'configured_service' => 'getConfiguredServiceService',
  25. 'decorated' => 'getDecoratedService',
  26. 'decorator_service' => 'getDecoratorServiceService',
  27. 'decorator_service_with_name' => 'getDecoratorServiceWithNameService',
  28. 'deprecated_service' => 'getDeprecatedServiceService',
  29. 'factory_service' => 'getFactoryServiceService',
  30. 'foo' => 'getFooService',
  31. 'foo.baz' => 'getFoo_BazService',
  32. 'foo_bar' => 'getFooBarService',
  33. 'foo_with_inline' => 'getFooWithInlineService',
  34. 'inlined' => 'getInlinedService',
  35. 'method_call1' => 'getMethodCall1Service',
  36. 'new_factory' => 'getNewFactoryService',
  37. 'new_factory_service' => 'getNewFactoryServiceService',
  38. 'request' => 'getRequestService',
  39. 'service_from_static_method' => 'getServiceFromStaticMethodService',
  40. );
  41. $this->aliases = array(
  42. 'alias_for_alias' => 'foo',
  43. 'alias_for_foo' => 'foo',
  44. );
  45. }
  46. /**
  47. * Gets the public 'bar' shared service.
  48. *
  49. * @return \Bar\FooClass
  50. */
  51. protected function getBarService()
  52. {
  53. $a = $this->get('foo.baz');
  54. $this->services['bar'] = $instance = new \Bar\FooClass('foo', $a, $this->getParameter('foo_bar'));
  55. $a->configure($instance);
  56. return $instance;
  57. }
  58. /**
  59. * Gets the public 'baz' shared service.
  60. *
  61. * @return \Baz
  62. */
  63. protected function getBazService()
  64. {
  65. $this->services['baz'] = $instance = new \Baz();
  66. $instance->setFoo($this->get('foo_with_inline'));
  67. return $instance;
  68. }
  69. /**
  70. * Gets the public 'configured_service' shared service.
  71. *
  72. * @return \stdClass
  73. */
  74. protected function getConfiguredServiceService()
  75. {
  76. $this->services['configured_service'] = $instance = new \stdClass();
  77. $this->get('configurator_service')->configureStdClass($instance);
  78. return $instance;
  79. }
  80. /**
  81. * Gets the public 'decorated' shared service.
  82. *
  83. * @return \stdClass
  84. */
  85. protected function getDecoratedService()
  86. {
  87. return $this->services['decorated'] = new \stdClass();
  88. }
  89. /**
  90. * Gets the public 'decorator_service' shared service.
  91. *
  92. * @return \stdClass
  93. */
  94. protected function getDecoratorServiceService()
  95. {
  96. return $this->services['decorator_service'] = new \stdClass();
  97. }
  98. /**
  99. * Gets the public 'decorator_service_with_name' shared service.
  100. *
  101. * @return \stdClass
  102. */
  103. protected function getDecoratorServiceWithNameService()
  104. {
  105. return $this->services['decorator_service_with_name'] = new \stdClass();
  106. }
  107. /**
  108. * Gets the public 'deprecated_service' shared service.
  109. *
  110. * @return \stdClass
  111. *
  112. * @deprecated The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.
  113. */
  114. protected function getDeprecatedServiceService()
  115. {
  116. @trigger_error('The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.', E_USER_DEPRECATED);
  117. return $this->services['deprecated_service'] = new \stdClass();
  118. }
  119. /**
  120. * Gets the public 'factory_service' shared service.
  121. *
  122. * @return \Bar
  123. */
  124. protected function getFactoryServiceService()
  125. {
  126. return $this->services['factory_service'] = $this->get('foo.baz')->getInstance();
  127. }
  128. /**
  129. * Gets the public 'foo' shared service.
  130. *
  131. * @return \Bar\FooClass
  132. */
  133. protected function getFooService()
  134. {
  135. $a = $this->get('foo.baz');
  136. $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')), true, $this);
  137. $instance->foo = 'bar';
  138. $instance->moo = $a;
  139. $instance->qux = array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo'));
  140. $instance->setBar($this->get('bar'));
  141. $instance->initialize();
  142. sc_configure($instance);
  143. return $instance;
  144. }
  145. /**
  146. * Gets the public 'foo.baz' shared service.
  147. *
  148. * @return object A %baz_class% instance
  149. */
  150. protected function getFoo_BazService()
  151. {
  152. $this->services['foo.baz'] = $instance = call_user_func(array($this->getParameter('baz_class'), 'getInstance'));
  153. call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance);
  154. return $instance;
  155. }
  156. /**
  157. * Gets the public 'foo_bar' service.
  158. *
  159. * @return object A %foo_class% instance
  160. */
  161. protected function getFooBarService()
  162. {
  163. $class = $this->getParameter('foo_class');
  164. return new $class();
  165. }
  166. /**
  167. * Gets the public 'foo_with_inline' shared service.
  168. *
  169. * @return \Foo
  170. */
  171. protected function getFooWithInlineService()
  172. {
  173. $this->services['foo_with_inline'] = $instance = new \Foo();
  174. $instance->setBar($this->get('inlined'));
  175. return $instance;
  176. }
  177. /**
  178. * Gets the public 'method_call1' shared service.
  179. *
  180. * @return \Bar\FooClass
  181. */
  182. protected function getMethodCall1Service()
  183. {
  184. require_once '%path%foo.php';
  185. $this->services['method_call1'] = $instance = new \Bar\FooClass();
  186. $instance->setBar($this->get('foo'));
  187. $instance->setBar($this->get('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  188. if ($this->has('foo3')) {
  189. $instance->setBar($this->get('foo3', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  190. }
  191. if ($this->has('foobaz')) {
  192. $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  193. }
  194. $instance->setBar(($this->get("foo")->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default"))));
  195. return $instance;
  196. }
  197. /**
  198. * Gets the public 'new_factory_service' shared service.
  199. *
  200. * @return \FooBarBaz
  201. */
  202. protected function getNewFactoryServiceService()
  203. {
  204. $this->services['new_factory_service'] = $instance = $this->get('new_factory')->getInstance();
  205. $instance->foo = 'bar';
  206. return $instance;
  207. }
  208. /**
  209. * Gets the public 'request' shared service.
  210. *
  211. * @throws RuntimeException always since this service is expected to be injected dynamically
  212. */
  213. protected function getRequestService()
  214. {
  215. throw new RuntimeException('You have requested a synthetic service ("request"). The DIC does not know how to construct this service.');
  216. }
  217. /**
  218. * Gets the public 'service_from_static_method' shared service.
  219. *
  220. * @return \Bar\FooClass
  221. */
  222. protected function getServiceFromStaticMethodService()
  223. {
  224. return $this->services['service_from_static_method'] = \Bar\FooClass::getInstance();
  225. }
  226. /**
  227. * Gets the private 'configurator_service' shared service.
  228. *
  229. * @return \ConfClass
  230. */
  231. protected function getConfiguratorServiceService()
  232. {
  233. $this->services['configurator_service'] = $instance = new \ConfClass();
  234. $instance->setFoo($this->get('baz'));
  235. return $instance;
  236. }
  237. /**
  238. * Gets the private 'inlined' shared service.
  239. *
  240. * @return \Bar
  241. */
  242. protected function getInlinedService()
  243. {
  244. $this->services['inlined'] = $instance = new \Bar();
  245. $instance->pub = 'pub';
  246. $instance->setBaz($this->get('baz'));
  247. return $instance;
  248. }
  249. /**
  250. * Gets the private 'new_factory' shared service.
  251. *
  252. * @return \FactoryClass
  253. */
  254. protected function getNewFactoryService()
  255. {
  256. $this->services['new_factory'] = $instance = new \FactoryClass();
  257. $instance->foo = 'bar';
  258. return $instance;
  259. }
  260. /**
  261. * Gets the default parameters.
  262. *
  263. * @return array An array of the default parameters
  264. */
  265. protected function getDefaultParameters()
  266. {
  267. return array(
  268. 'baz_class' => 'BazClass',
  269. 'foo_class' => 'Bar\\FooClass',
  270. 'foo' => 'bar',
  271. );
  272. }
  273. }