services9.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <?php
  2. use Symfony\Component\DependencyInjection\ContainerInterface;
  3. use Symfony\Component\DependencyInjection\TaggedContainerInterface;
  4. use Symfony\Component\DependencyInjection\Container;
  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 implements TaggedContainerInterface
  15. {
  16. /**
  17. * Constructor.
  18. */
  19. public function __construct()
  20. {
  21. parent::__construct(new ParameterBag($this->getDefaultParameters()));
  22. }
  23. /**
  24. * Gets the 'foo' service.
  25. *
  26. * @return FooClass A FooClass instance.
  27. */
  28. protected function getFooService()
  29. {
  30. $instance = call_user_func(array('FooClass', 'getInstance'), 'foo', $this->get('foo.baz'), array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo'), 'bar' => $this->getParameter('foo')), true, $this);
  31. $instance->setBar($this->get('bar'));
  32. $instance->initialize();
  33. sc_configure($instance);
  34. return $instance;
  35. }
  36. /**
  37. * Gets the 'bar' service.
  38. *
  39. * This service is shared.
  40. * This method always returns the same instance of the service.
  41. *
  42. * @return FooClass A FooClass instance.
  43. */
  44. protected function getBarService()
  45. {
  46. $this->services['bar'] = $instance = new \FooClass('foo', $this->get('foo.baz'), $this->getParameter('foo_bar'));
  47. $this->get('foo.baz')->configure($instance);
  48. return $instance;
  49. }
  50. /**
  51. * Gets the 'foo.baz' service.
  52. *
  53. * This service is shared.
  54. * This method always returns the same instance of the service.
  55. *
  56. * @return Object A %baz_class% instance.
  57. */
  58. protected function getFoo_BazService()
  59. {
  60. $this->services['foo.baz'] = $instance = call_user_func(array($this->getParameter('baz_class'), 'getInstance'));
  61. call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance);
  62. return $instance;
  63. }
  64. /**
  65. * Gets the 'foo_bar' service.
  66. *
  67. * This service is shared.
  68. * This method always returns the same instance of the service.
  69. *
  70. * @return Object A %foo_class% instance.
  71. */
  72. protected function getFooBarService()
  73. {
  74. $class = $this->getParameter('foo_class');
  75. $this->services['foo_bar'] = $instance = new $class();
  76. return $instance;
  77. }
  78. /**
  79. * Gets the 'method_call1' service.
  80. *
  81. * This service is shared.
  82. * This method always returns the same instance of the service.
  83. *
  84. * @return FooClass A FooClass instance.
  85. */
  86. protected function getMethodCall1Service()
  87. {
  88. require_once '%path%foo.php';
  89. $this->services['method_call1'] = $instance = new \FooClass();
  90. $instance->setBar($this->get('foo'));
  91. $instance->setBar($this->get('foo', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  92. if ($this->has('foo')) {
  93. $instance->setBar($this->get('foo', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  94. }
  95. if ($this->has('foobaz')) {
  96. $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  97. }
  98. return $instance;
  99. }
  100. /**
  101. * Gets the 'factory_service' service.
  102. *
  103. * This service is shared.
  104. * This method always returns the same instance of the service.
  105. *
  106. * @return Object An instance returned by foo.baz::getInstance().
  107. */
  108. protected function getFactoryServiceService()
  109. {
  110. $this->services['factory_service'] = $instance = $this->get('foo.baz')->getInstance();
  111. return $instance;
  112. }
  113. /**
  114. * Gets the alias_for_foo service alias.
  115. *
  116. * @return FooClass An instance of the foo service
  117. */
  118. protected function getAliasForFooService()
  119. {
  120. return $this->get('foo');
  121. }
  122. /**
  123. * Returns service ids for a given tag.
  124. *
  125. * @param string $name The tag name
  126. *
  127. * @return array An array of tags
  128. */
  129. public function findTaggedServiceIds($name)
  130. {
  131. static $tags = array (
  132. 'foo' =>
  133. array (
  134. 'foo' =>
  135. array (
  136. 0 =>
  137. array (
  138. 'foo' => 'foo',
  139. ),
  140. 1 =>
  141. array (
  142. 'bar' => 'bar',
  143. ),
  144. ),
  145. ),
  146. );
  147. return isset($tags[$name]) ? $tags[$name] : array();
  148. }
  149. /**
  150. * Gets the default parameters.
  151. *
  152. * @return array An array of the default parameters
  153. */
  154. protected function getDefaultParameters()
  155. {
  156. return array(
  157. 'baz_class' => 'BazClass',
  158. 'foo_class' => 'FooClass',
  159. 'foo' => 'bar',
  160. );
  161. }
  162. }