services9.php 4.5 KB

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