services9.php 4.4 KB

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