/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php

https://github.com/nattaphat/hgis · PHP · 243 lines · 113 code · 38 blank · 92 comment · 4 complexity · 730b44aa5ab36c5072afd0272886fe53 MD5 · raw file

  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\Exception\InvalidArgumentException;
  6. use Symfony\Component\DependencyInjection\Exception\LogicException;
  7. use Symfony\Component\DependencyInjection\Exception\RuntimeException;
  8. use Symfony\Component\DependencyInjection\Reference;
  9. use Symfony\Component\DependencyInjection\Parameter;
  10. use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
  11. /**
  12. * ProjectServiceContainer
  13. *
  14. * This class has been auto-generated
  15. * by the Symfony Dependency Injection Component.
  16. */
  17. class ProjectServiceContainer extends Container
  18. {
  19. /**
  20. * Constructor.
  21. */
  22. public function __construct()
  23. {
  24. $this->parameters = $this->getDefaultParameters();
  25. $this->services =
  26. $this->scopedServices =
  27. $this->scopeStacks = array();
  28. $this->set('service_container', $this);
  29. $this->scopes = array();
  30. $this->scopeChildren = array();
  31. }
  32. /**
  33. * Gets the 'bar' service.
  34. *
  35. * This service is shared.
  36. * This method always returns the same instance of the service.
  37. *
  38. * @return FooClass A FooClass instance.
  39. */
  40. protected function getBarService()
  41. {
  42. $this->services['bar'] = $instance = new \FooClass('foo', $this->get('foo.baz'), $this->getParameter('foo_bar'));
  43. $this->get('foo.baz')->configure($instance);
  44. return $instance;
  45. }
  46. /**
  47. * Gets the 'baz' service.
  48. *
  49. * This service is shared.
  50. * This method always returns the same instance of the service.
  51. *
  52. * @return Baz A Baz instance.
  53. */
  54. protected function getBazService()
  55. {
  56. $this->services['baz'] = $instance = new \Baz();
  57. $instance->setFoo($this->get('foo_with_inline'));
  58. return $instance;
  59. }
  60. /**
  61. * Gets the 'factory_service' service.
  62. *
  63. * This service is shared.
  64. * This method always returns the same instance of the service.
  65. *
  66. * @return Bar A Bar instance.
  67. */
  68. protected function getFactoryServiceService()
  69. {
  70. return $this->services['factory_service'] = $this->get('foo.baz')->getInstance();
  71. }
  72. /**
  73. * Gets the 'foo' service.
  74. *
  75. * This service is shared.
  76. * This method always returns the same instance of the service.
  77. *
  78. * @return FooClass A FooClass instance.
  79. */
  80. protected function getFooService()
  81. {
  82. $a = $this->get('foo.baz');
  83. $this->services['foo'] = $instance = call_user_func(array('FooClass', 'getInstance'), 'foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this);
  84. $instance->setBar($this->get('bar'));
  85. $instance->initialize();
  86. $instance->foo = 'bar';
  87. $instance->moo = $a;
  88. sc_configure($instance);
  89. return $instance;
  90. }
  91. /**
  92. * Gets the 'foo.baz' service.
  93. *
  94. * This service is shared.
  95. * This method always returns the same instance of the service.
  96. *
  97. * @return BazClass A BazClass instance.
  98. */
  99. protected function getFoo_BazService()
  100. {
  101. $this->services['foo.baz'] = $instance = call_user_func(array('BazClass', 'getInstance'));
  102. call_user_func(array('BazClass', 'configureStatic1'), $instance);
  103. return $instance;
  104. }
  105. /**
  106. * Gets the 'foo_bar' service.
  107. *
  108. * @return FooClass A FooClass instance.
  109. */
  110. protected function getFooBarService()
  111. {
  112. return new \FooClass();
  113. }
  114. /**
  115. * Gets the 'foo_with_inline' service.
  116. *
  117. * This service is shared.
  118. * This method always returns the same instance of the service.
  119. *
  120. * @return Foo A Foo instance.
  121. */
  122. protected function getFooWithInlineService()
  123. {
  124. $a = new \Bar();
  125. $this->services['foo_with_inline'] = $instance = new \Foo();
  126. $a->setBaz($this->get('baz'));
  127. $a->pub = 'pub';
  128. $instance->setBar($a);
  129. return $instance;
  130. }
  131. /**
  132. * Gets the 'method_call1' service.
  133. *
  134. * This service is shared.
  135. * This method always returns the same instance of the service.
  136. *
  137. * @return FooClass A FooClass instance.
  138. */
  139. protected function getMethodCall1Service()
  140. {
  141. require_once '%path%foo.php';
  142. $this->services['method_call1'] = $instance = new \FooClass();
  143. $instance->setBar($this->get('foo'));
  144. $instance->setBar(NULL);
  145. return $instance;
  146. }
  147. /**
  148. * Gets the alias_for_foo service alias.
  149. *
  150. * @return FooClass An instance of the foo service
  151. */
  152. protected function getAliasForFooService()
  153. {
  154. return $this->get('foo');
  155. }
  156. /**
  157. * {@inheritdoc}
  158. */
  159. public function getParameter($name)
  160. {
  161. $name = strtolower($name);
  162. if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters))) {
  163. throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
  164. }
  165. return $this->parameters[$name];
  166. }
  167. /**
  168. * {@inheritdoc}
  169. */
  170. public function hasParameter($name)
  171. {
  172. $name = strtolower($name);
  173. return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters);
  174. }
  175. /**
  176. * {@inheritdoc}
  177. */
  178. public function setParameter($name, $value)
  179. {
  180. throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
  181. }
  182. /**
  183. * {@inheritDoc}
  184. */
  185. public function getParameterBag()
  186. {
  187. if (null === $this->parameterBag) {
  188. $this->parameterBag = new FrozenParameterBag($this->parameters);
  189. }
  190. return $this->parameterBag;
  191. }
  192. /**
  193. * Gets the default parameters.
  194. *
  195. * @return array An array of the default parameters
  196. */
  197. protected function getDefaultParameters()
  198. {
  199. return array(
  200. 'baz_class' => 'BazClass',
  201. 'foo_class' => 'FooClass',
  202. 'foo' => 'bar',
  203. );
  204. }
  205. }