services9.php 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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\Reference;
  6. use Symfony\Component\DependencyInjection\Parameter;
  7. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
  8. /**
  9. * ProjectServiceContainer
  10. *
  11. * This class has been auto-generated
  12. * by the Symfony Dependency Injection Component.
  13. */
  14. class ProjectServiceContainer extends Container
  15. {
  16. /**
  17. * Constructor.
  18. */
  19. public function __construct()
  20. {
  21. parent::__construct(new ParameterBag($this->getDefaultParameters()));
  22. }
  23. /**
  24. * Gets the 'bar' service.
  25. *
  26. * This service is shared.
  27. * This method always returns the same instance of the service.
  28. *
  29. * @return FooClass A FooClass instance.
  30. */
  31. protected function getBarService()
  32. {
  33. $this->services['bar'] = $instance = new \FooClass('foo', $this->get('foo.baz'), $this->getParameter('foo_bar'));
  34. $this->get('foo.baz')->configure($instance);
  35. return $instance;
  36. }
  37. /**
  38. * Gets the 'baz' service.
  39. *
  40. * This service is shared.
  41. * This method always returns the same instance of the service.
  42. *
  43. * @return Baz A Baz instance.
  44. */
  45. protected function getBazService()
  46. {
  47. $this->services['baz'] = $instance = new \Baz();
  48. $instance->setFoo($this->get('foo_with_inline'));
  49. return $instance;
  50. }
  51. /**
  52. * Gets the 'factory_service' service.
  53. *
  54. * This service is shared.
  55. * This method always returns the same instance of the service.
  56. *
  57. * @return Bar A Bar instance.
  58. */
  59. protected function getFactoryServiceService()
  60. {
  61. return $this->services['factory_service'] = $this->get('foo.baz')->getInstance();
  62. }
  63. /**
  64. * Gets the 'foo' service.
  65. *
  66. * This service is shared.
  67. * This method always returns the same instance of the service.
  68. *
  69. * @return FooClass A FooClass instance.
  70. */
  71. protected function getFooService()
  72. {
  73. $a = $this->get('foo.baz');
  74. $this->services['foo'] = $instance = call_user_func(array('FooClass', 'getInstance'), 'foo', $a, array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo'), 'foobar' => $this->getParameter('foo')), true, $this);
  75. $instance->setBar($this->get('bar'));
  76. $instance->initialize();
  77. $instance->foo = 'bar';
  78. $instance->moo = $a;
  79. sc_configure($instance);
  80. return $instance;
  81. }
  82. /**
  83. * Gets the 'foo.baz' service.
  84. *
  85. * This service is shared.
  86. * This method always returns the same instance of the service.
  87. *
  88. * @return Object A %baz_class% instance.
  89. */
  90. protected function getFoo_BazService()
  91. {
  92. $this->services['foo.baz'] = $instance = call_user_func(array($this->getParameter('baz_class'), 'getInstance'));
  93. call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance);
  94. return $instance;
  95. }
  96. /**
  97. * Gets the 'foo_bar' service.
  98. *
  99. * @return Object A %foo_class% instance.
  100. */
  101. protected function getFooBarService()
  102. {
  103. $class = $this->getParameter('foo_class');
  104. return new $class();
  105. }
  106. /**
  107. * Gets the 'foo_with_inline' service.
  108. *
  109. * This service is shared.
  110. * This method always returns the same instance of the service.
  111. *
  112. * @return Foo A Foo instance.
  113. */
  114. protected function getFooWithInlineService()
  115. {
  116. $this->services['foo_with_inline'] = $instance = new \Foo();
  117. $instance->setBar($this->get('inlined'));
  118. return $instance;
  119. }
  120. /**
  121. * Gets the 'method_call1' service.
  122. *
  123. * This service is shared.
  124. * This method always returns the same instance of the service.
  125. *
  126. * @return FooClass A FooClass instance.
  127. */
  128. protected function getMethodCall1Service()
  129. {
  130. require_once '%path%foo.php';
  131. $this->services['method_call1'] = $instance = new \FooClass();
  132. $instance->setBar($this->get('foo'));
  133. $instance->setBar($this->get('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  134. if ($this->has('foo3')) {
  135. $instance->setBar($this->get('foo3', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  136. }
  137. if ($this->has('foobaz')) {
  138. $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  139. }
  140. return $instance;
  141. }
  142. /**
  143. * Gets the alias_for_foo service alias.
  144. *
  145. * @return FooClass An instance of the foo service
  146. */
  147. protected function getAliasForFooService()
  148. {
  149. return $this->get('foo');
  150. }
  151. /**
  152. * Gets the 'inlined' service.
  153. *
  154. * This service is shared.
  155. * This method always returns the same instance of the service.
  156. *
  157. * This service is private.
  158. * If you want to be able to request this service from the container directly,
  159. * make it public, otherwise you might end up with broken code.
  160. *
  161. * @return Bar A Bar instance.
  162. */
  163. protected function getInlinedService()
  164. {
  165. $this->services['inlined'] = $instance = new \Bar();
  166. $instance->setBaz($this->get('baz'));
  167. $instance->pub = 'pub';
  168. return $instance;
  169. }
  170. /**
  171. * Gets the default parameters.
  172. *
  173. * @return array An array of the default parameters
  174. */
  175. protected function getDefaultParameters()
  176. {
  177. return array(
  178. 'baz_class' => 'BazClass',
  179. 'foo_class' => 'FooClass',
  180. 'foo' => 'bar',
  181. );
  182. }
  183. }