services9.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php
  2. use Symfony\Component\DependencyInjection\ContainerInterface;
  3. use Symfony\Component\DependencyInjection\Container;
  4. use Symfony\Component\DependencyInjection\Reference;
  5. use Symfony\Component\DependencyInjection\Parameter;
  6. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
  7. /**
  8. * ProjectServiceContainer
  9. *
  10. * This class has been auto-generated
  11. * by the Symfony Dependency Injection Component.
  12. */
  13. class ProjectServiceContainer extends Container
  14. {
  15. /**
  16. * Constructor.
  17. */
  18. public function __construct()
  19. {
  20. parent::__construct(new ParameterBag($this->getDefaultParameters()));
  21. }
  22. /**
  23. * Gets the 'bar' service.
  24. *
  25. * This service is shared.
  26. * This method always returns the same instance of the service.
  27. *
  28. * @return FooClass A FooClass instance.
  29. */
  30. protected function getBarService()
  31. {
  32. $this->services['bar'] = $instance = new \FooClass('foo', $this->get('foo.baz'), $this->getParameter('foo_bar'));
  33. $this->get('foo.baz')->configure($instance);
  34. return $instance;
  35. }
  36. /**
  37. * Gets the 'factory_service' service.
  38. *
  39. * This service is shared.
  40. * This method always returns the same instance of the service.
  41. *
  42. * @return Object An instance returned by foo.baz::getInstance().
  43. */
  44. protected function getFactoryServiceService()
  45. {
  46. return $this->services['factory_service'] = $this->get('foo.baz')->getInstance();
  47. }
  48. /**
  49. * Gets the 'foo' service.
  50. *
  51. * @return FooClass A FooClass instance.
  52. */
  53. protected function getFooService()
  54. {
  55. $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);
  56. $instance->setBar($this->get('bar'));
  57. $instance->initialize();
  58. sc_configure($instance);
  59. return $instance;
  60. }
  61. /**
  62. * Gets the 'foo.baz' service.
  63. *
  64. * This service is shared.
  65. * This method always returns the same instance of the service.
  66. *
  67. * @return Object A %baz_class% instance.
  68. */
  69. protected function getFoo_BazService()
  70. {
  71. $this->services['foo.baz'] = $instance = call_user_func(array($this->getParameter('baz_class'), 'getInstance'));
  72. call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance);
  73. return $instance;
  74. }
  75. /**
  76. * Gets the 'foo_bar' service.
  77. *
  78. * This service is shared.
  79. * This method always returns the same instance of the service.
  80. *
  81. * @return Object A %foo_class% instance.
  82. */
  83. protected function getFooBarService()
  84. {
  85. $class = $this->getParameter('foo_class');
  86. return $this->services['foo_bar'] = new $class();
  87. }
  88. /**
  89. * Gets the 'method_call1' service.
  90. *
  91. * This service is shared.
  92. * This method always returns the same instance of the service.
  93. *
  94. * @return FooClass A FooClass instance.
  95. */
  96. protected function getMethodCall1Service()
  97. {
  98. require_once '%path%foo.php';
  99. $this->services['method_call1'] = $instance = new \FooClass();
  100. $instance->setBar($this->get('foo'));
  101. $instance->setBar($this->get('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  102. if ($this->has('foo3')) {
  103. $instance->setBar($this->get('foo3', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  104. }
  105. if ($this->has('foobaz')) {
  106. $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  107. }
  108. return $instance;
  109. }
  110. /**
  111. * Gets the alias_for_foo service alias.
  112. *
  113. * @return FooClass An instance of the foo service
  114. */
  115. protected function getAliasForFooService()
  116. {
  117. return $this->get('foo');
  118. }
  119. /**
  120. * Gets the default parameters.
  121. *
  122. * @return array An array of the default parameters
  123. */
  124. protected function getDefaultParameters()
  125. {
  126. return array(
  127. 'baz_class' => 'BazClass',
  128. 'foo_class' => 'FooClass',
  129. 'foo' => 'bar',
  130. );
  131. }
  132. }