services9.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. return $this->services['foo_bar'] = new $class();
  76. }
  77. /**
  78. * Gets the 'method_call1' service.
  79. *
  80. * This service is shared.
  81. * This method always returns the same instance of the service.
  82. *
  83. * @return FooClass A FooClass instance.
  84. */
  85. protected function getMethodCall1Service()
  86. {
  87. require_once '%path%foo.php';
  88. $this->services['method_call1'] = $instance = new \FooClass();
  89. $instance->setBar($this->get('foo'));
  90. $instance->setBar($this->get('foo', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  91. if ($this->has('foo')) {
  92. $instance->setBar($this->get('foo', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  93. }
  94. if ($this->has('foobaz')) {
  95. $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  96. }
  97. return $instance;
  98. }
  99. /**
  100. * Gets the 'factory_service' service.
  101. *
  102. * This service is shared.
  103. * This method always returns the same instance of the service.
  104. *
  105. * @return Object An instance returned by foo.baz::getInstance().
  106. */
  107. protected function getFactoryServiceService()
  108. {
  109. return $this->services['factory_service'] = $this->get('foo.baz')->getInstance();
  110. }
  111. /**
  112. * Gets the alias_for_foo service alias.
  113. *
  114. * @return FooClass An instance of the foo service
  115. */
  116. protected function getAliasForFooService()
  117. {
  118. return $this->get('foo');
  119. }
  120. /**
  121. * Returns service ids for a given tag.
  122. *
  123. * @param string $name The tag name
  124. *
  125. * @return array An array of tags
  126. */
  127. public function findTaggedServiceIds($name)
  128. {
  129. static $tags = array(
  130. 'foo' => array(
  131. 'foo' => array(
  132. 0 => array(
  133. 'foo' => 'foo',
  134. ),
  135. 1 => array(
  136. 'bar' => 'bar',
  137. ),
  138. ),
  139. ),
  140. );
  141. return isset($tags[$name]) ? $tags[$name] : array();
  142. }
  143. /**
  144. * Gets the default parameters.
  145. *
  146. * @return array An array of the default parameters
  147. */
  148. protected function getDefaultParameters()
  149. {
  150. return array(
  151. 'baz_class' => 'BazClass',
  152. 'foo_class' => 'FooClass',
  153. 'foo' => 'bar',
  154. );
  155. }
  156. }