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 'foo' service.
  24. *
  25. * @return FooClass A FooClass instance.
  26. */
  27. protected function getFooService()
  28. {
  29. $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);
  30. $instance->setBar($this->get('bar'));
  31. $instance->initialize();
  32. sc_configure($instance);
  33. return $instance;
  34. }
  35. /**
  36. * Gets the 'bar' service.
  37. *
  38. * This service is shared.
  39. * This method always returns the same instance of the service.
  40. *
  41. * @return FooClass A FooClass instance.
  42. */
  43. protected function getBarService()
  44. {
  45. $this->services['bar'] = $instance = new \FooClass('foo', $this->get('foo.baz'), $this->getParameter('foo_bar'));
  46. $this->get('foo.baz')->configure($instance);
  47. return $instance;
  48. }
  49. /**
  50. * Gets the 'foo.baz' service.
  51. *
  52. * This service is shared.
  53. * This method always returns the same instance of the service.
  54. *
  55. * @return Object A %baz_class% instance.
  56. */
  57. protected function getFoo_BazService()
  58. {
  59. $this->services['foo.baz'] = $instance = call_user_func(array($this->getParameter('baz_class'), 'getInstance'));
  60. call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance);
  61. return $instance;
  62. }
  63. /**
  64. * Gets the 'foo_bar' service.
  65. *
  66. * This service is shared.
  67. * This method always returns the same instance of the service.
  68. *
  69. * @return Object A %foo_class% instance.
  70. */
  71. protected function getFooBarService()
  72. {
  73. $class = $this->getParameter('foo_class');
  74. return $this->services['foo_bar'] = new $class();
  75. }
  76. /**
  77. * Gets the 'method_call1' service.
  78. *
  79. * This service is shared.
  80. * This method always returns the same instance of the service.
  81. *
  82. * @return FooClass A FooClass instance.
  83. */
  84. protected function getMethodCall1Service()
  85. {
  86. require_once '%path%foo.php';
  87. $this->services['method_call1'] = $instance = new \FooClass();
  88. $instance->setBar($this->get('foo'));
  89. $instance->setBar($this->get('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  90. if ($this->has('foo3')) {
  91. $instance->setBar($this->get('foo3', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  92. }
  93. if ($this->has('foobaz')) {
  94. $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  95. }
  96. return $instance;
  97. }
  98. /**
  99. * Gets the 'factory_service' service.
  100. *
  101. * This service is shared.
  102. * This method always returns the same instance of the service.
  103. *
  104. * @return Object An instance returned by foo.baz::getInstance().
  105. */
  106. protected function getFactoryServiceService()
  107. {
  108. return $this->services['factory_service'] = $this->get('foo.baz')->getInstance();
  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. }