services9.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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 'factory_service' service.
  39. *
  40. * This service is shared.
  41. * This method always returns the same instance of the service.
  42. *
  43. * @return Object An instance returned by foo.baz::getInstance().
  44. */
  45. protected function getFactoryServiceService()
  46. {
  47. return $this->services['factory_service'] = $this->get('foo.baz')->getInstance();
  48. }
  49. /**
  50. * Gets the 'foo' service.
  51. *
  52. * @return FooClass A FooClass instance.
  53. */
  54. protected function getFooService()
  55. {
  56. $a = $this->get('foo.baz');
  57. $instance = call_user_func(array('FooClass', 'getInstance'), 'foo', $a, array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo'), 'bar' => $this->getParameter('foo')), true, $this);
  58. $instance->setBar($this->get('bar'));
  59. $instance->initialize();
  60. $instance->foo = 'bar';
  61. $instance->moo = $a;
  62. sc_configure($instance);
  63. return $instance;
  64. }
  65. /**
  66. * Gets the 'foo.baz' service.
  67. *
  68. * This service is shared.
  69. * This method always returns the same instance of the service.
  70. *
  71. * @return Object A %baz_class% instance.
  72. */
  73. protected function getFoo_BazService()
  74. {
  75. $this->services['foo.baz'] = $instance = call_user_func(array($this->getParameter('baz_class'), 'getInstance'));
  76. call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance);
  77. return $instance;
  78. }
  79. /**
  80. * Gets the 'foo_bar' service.
  81. *
  82. * This service is shared.
  83. * This method always returns the same instance of the service.
  84. *
  85. * @return Object A %foo_class% instance.
  86. */
  87. protected function getFooBarService()
  88. {
  89. $class = $this->getParameter('foo_class');
  90. return $this->services['foo_bar'] = new $class();
  91. }
  92. /**
  93. * Gets the 'method_call1' service.
  94. *
  95. * This service is shared.
  96. * This method always returns the same instance of the service.
  97. *
  98. * @return FooClass A FooClass instance.
  99. */
  100. protected function getMethodCall1Service()
  101. {
  102. require_once '%path%foo.php';
  103. $this->services['method_call1'] = $instance = new \FooClass();
  104. $instance->setBar($this->get('foo'));
  105. $instance->setBar($this->get('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  106. if ($this->has('foo3')) {
  107. $instance->setBar($this->get('foo3', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  108. }
  109. if ($this->has('foobaz')) {
  110. $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  111. }
  112. return $instance;
  113. }
  114. /**
  115. * Gets the alias_for_foo service alias.
  116. *
  117. * @return FooClass An instance of the foo service
  118. */
  119. protected function getAliasForFooService()
  120. {
  121. return $this->get('foo');
  122. }
  123. /**
  124. * Gets the default parameters.
  125. *
  126. * @return array An array of the default parameters
  127. */
  128. protected function getDefaultParameters()
  129. {
  130. return array(
  131. 'baz_class' => 'BazClass',
  132. 'foo_class' => 'FooClass',
  133. 'foo' => 'bar',
  134. );
  135. }
  136. }