PageRenderTime 49ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9.php

https://gitlab.com/yousafsyed/easternglamor
PHP | 394 lines | 167 code | 50 blank | 177 comment | 2 complexity | a030c645c85a9554f3a48787bb5b1b7a 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\ParameterBag\ParameterBag;
  9. /**
  10. * ProjectServiceContainer.
  11. *
  12. * This class has been auto-generated
  13. * by the Symfony Dependency Injection Component.
  14. */
  15. class ProjectServiceContainer extends Container
  16. {
  17. private $parameters;
  18. private $targetDirs = array();
  19. /**
  20. * Constructor.
  21. */
  22. public function __construct()
  23. {
  24. parent::__construct(new ParameterBag($this->getDefaultParameters()));
  25. $this->methodMap = array(
  26. 'bar' => 'getBarService',
  27. 'baz' => 'getBazService',
  28. 'configurator_service' => 'getConfiguratorServiceService',
  29. 'configured_service' => 'getConfiguredServiceService',
  30. 'decorated' => 'getDecoratedService',
  31. 'decorator_service' => 'getDecoratorServiceService',
  32. 'decorator_service_with_name' => 'getDecoratorServiceWithNameService',
  33. 'deprecated_service' => 'getDeprecatedServiceService',
  34. 'factory_service' => 'getFactoryServiceService',
  35. 'foo' => 'getFooService',
  36. 'foo.baz' => 'getFoo_BazService',
  37. 'foo_bar' => 'getFooBarService',
  38. 'foo_with_inline' => 'getFooWithInlineService',
  39. 'inlined' => 'getInlinedService',
  40. 'method_call1' => 'getMethodCall1Service',
  41. 'new_factory' => 'getNewFactoryService',
  42. 'new_factory_service' => 'getNewFactoryServiceService',
  43. 'request' => 'getRequestService',
  44. 'service_from_static_method' => 'getServiceFromStaticMethodService',
  45. );
  46. $this->aliases = array(
  47. 'alias_for_alias' => 'foo',
  48. 'alias_for_foo' => 'foo',
  49. );
  50. }
  51. /**
  52. * Gets the 'bar' service.
  53. *
  54. * This service is shared.
  55. * This method always returns the same instance of the service.
  56. *
  57. * @return \Bar\FooClass A Bar\FooClass instance.
  58. */
  59. protected function getBarService()
  60. {
  61. $a = $this->get('foo.baz');
  62. $this->services['bar'] = $instance = new \Bar\FooClass('foo', $a, $this->getParameter('foo_bar'));
  63. $a->configure($instance);
  64. return $instance;
  65. }
  66. /**
  67. * Gets the 'baz' service.
  68. *
  69. * This service is shared.
  70. * This method always returns the same instance of the service.
  71. *
  72. * @return \Baz A Baz instance.
  73. */
  74. protected function getBazService()
  75. {
  76. $this->services['baz'] = $instance = new \Baz();
  77. $instance->setFoo($this->get('foo_with_inline'));
  78. return $instance;
  79. }
  80. /**
  81. * Gets the 'configured_service' service.
  82. *
  83. * This service is shared.
  84. * This method always returns the same instance of the service.
  85. *
  86. * @return \stdClass A stdClass instance.
  87. */
  88. protected function getConfiguredServiceService()
  89. {
  90. $this->services['configured_service'] = $instance = new \stdClass();
  91. $this->get('configurator_service')->configureStdClass($instance);
  92. return $instance;
  93. }
  94. /**
  95. * Gets the 'decorated' service.
  96. *
  97. * This service is shared.
  98. * This method always returns the same instance of the service.
  99. *
  100. * @return \stdClass A stdClass instance.
  101. */
  102. protected function getDecoratedService()
  103. {
  104. return $this->services['decorated'] = new \stdClass();
  105. }
  106. /**
  107. * Gets the 'decorator_service' service.
  108. *
  109. * This service is shared.
  110. * This method always returns the same instance of the service.
  111. *
  112. * @return \stdClass A stdClass instance.
  113. */
  114. protected function getDecoratorServiceService()
  115. {
  116. return $this->services['decorator_service'] = new \stdClass();
  117. }
  118. /**
  119. * Gets the 'decorator_service_with_name' service.
  120. *
  121. * This service is shared.
  122. * This method always returns the same instance of the service.
  123. *
  124. * @return \stdClass A stdClass instance.
  125. */
  126. protected function getDecoratorServiceWithNameService()
  127. {
  128. return $this->services['decorator_service_with_name'] = new \stdClass();
  129. }
  130. /**
  131. * Gets the 'deprecated_service' service.
  132. *
  133. * This service is shared.
  134. * This method always returns the same instance of the service.
  135. *
  136. * @return \stdClass A stdClass instance.
  137. *
  138. * @deprecated The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.
  139. */
  140. protected function getDeprecatedServiceService()
  141. {
  142. @trigger_error('The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.', E_USER_DEPRECATED);
  143. return $this->services['deprecated_service'] = new \stdClass();
  144. }
  145. /**
  146. * Gets the 'factory_service' service.
  147. *
  148. * This service is shared.
  149. * This method always returns the same instance of the service.
  150. *
  151. * @return \Bar A Bar instance.
  152. */
  153. protected function getFactoryServiceService()
  154. {
  155. return $this->services['factory_service'] = $this->get('foo.baz')->getInstance();
  156. }
  157. /**
  158. * Gets the 'foo' service.
  159. *
  160. * This service is shared.
  161. * This method always returns the same instance of the service.
  162. *
  163. * @return \Bar\FooClass A Bar\FooClass instance.
  164. */
  165. protected function getFooService()
  166. {
  167. $a = $this->get('foo.baz');
  168. $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')), true, $this);
  169. $instance->setBar($this->get('bar'));
  170. $instance->initialize();
  171. $instance->foo = 'bar';
  172. $instance->moo = $a;
  173. $instance->qux = array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo'));
  174. sc_configure($instance);
  175. return $instance;
  176. }
  177. /**
  178. * Gets the 'foo.baz' service.
  179. *
  180. * This service is shared.
  181. * This method always returns the same instance of the service.
  182. *
  183. * @return object A %baz_class% instance.
  184. */
  185. protected function getFoo_BazService()
  186. {
  187. $this->services['foo.baz'] = $instance = call_user_func(array($this->getParameter('baz_class'), 'getInstance'));
  188. call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance);
  189. return $instance;
  190. }
  191. /**
  192. * Gets the 'foo_bar' service.
  193. *
  194. * @return object A %foo_class% instance.
  195. */
  196. protected function getFooBarService()
  197. {
  198. $class = $this->getParameter('foo_class');
  199. return new $class();
  200. }
  201. /**
  202. * Gets the 'foo_with_inline' service.
  203. *
  204. * This service is shared.
  205. * This method always returns the same instance of the service.
  206. *
  207. * @return \Foo A Foo instance.
  208. */
  209. protected function getFooWithInlineService()
  210. {
  211. $this->services['foo_with_inline'] = $instance = new \Foo();
  212. $instance->setBar($this->get('inlined'));
  213. return $instance;
  214. }
  215. /**
  216. * Gets the 'method_call1' service.
  217. *
  218. * This service is shared.
  219. * This method always returns the same instance of the service.
  220. *
  221. * @return \Bar\FooClass A Bar\FooClass instance.
  222. */
  223. protected function getMethodCall1Service()
  224. {
  225. require_once '%path%foo.php';
  226. $this->services['method_call1'] = $instance = new \Bar\FooClass();
  227. $instance->setBar($this->get('foo'));
  228. $instance->setBar($this->get('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  229. if ($this->has('foo3')) {
  230. $instance->setBar($this->get('foo3', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  231. }
  232. if ($this->has('foobaz')) {
  233. $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
  234. }
  235. $instance->setBar(($this->get("foo")->foo() . (($this->hasparameter("foo")) ? ($this->getParameter("foo")) : ("default"))));
  236. return $instance;
  237. }
  238. /**
  239. * Gets the 'new_factory_service' service.
  240. *
  241. * This service is shared.
  242. * This method always returns the same instance of the service.
  243. *
  244. * @return \FooBarBaz A FooBarBaz instance.
  245. */
  246. protected function getNewFactoryServiceService()
  247. {
  248. $this->services['new_factory_service'] = $instance = $this->get('new_factory')->getInstance();
  249. $instance->foo = 'bar';
  250. return $instance;
  251. }
  252. /**
  253. * Gets the 'request' service.
  254. *
  255. * This service is shared.
  256. * This method always returns the same instance of the service.
  257. *
  258. * @throws RuntimeException always since this service is expected to be injected dynamically
  259. */
  260. protected function getRequestService()
  261. {
  262. throw new RuntimeException('You have requested a synthetic service ("request"). The DIC does not know how to construct this service.');
  263. }
  264. /**
  265. * Gets the 'service_from_static_method' service.
  266. *
  267. * This service is shared.
  268. * This method always returns the same instance of the service.
  269. *
  270. * @return \Bar\FooClass A Bar\FooClass instance.
  271. */
  272. protected function getServiceFromStaticMethodService()
  273. {
  274. return $this->services['service_from_static_method'] = \Bar\FooClass::getInstance();
  275. }
  276. /**
  277. * Gets the 'configurator_service' service.
  278. *
  279. * This service is shared.
  280. * This method always returns the same instance of the service.
  281. *
  282. * This service is private.
  283. * If you want to be able to request this service from the container directly,
  284. * make it public, otherwise you might end up with broken code.
  285. *
  286. * @return \ConfClass A ConfClass instance.
  287. */
  288. protected function getConfiguratorServiceService()
  289. {
  290. $this->services['configurator_service'] = $instance = new \ConfClass();
  291. $instance->setFoo($this->get('baz'));
  292. return $instance;
  293. }
  294. /**
  295. * Gets the 'inlined' service.
  296. *
  297. * This service is shared.
  298. * This method always returns the same instance of the service.
  299. *
  300. * This service is private.
  301. * If you want to be able to request this service from the container directly,
  302. * make it public, otherwise you might end up with broken code.
  303. *
  304. * @return \Bar A Bar instance.
  305. */
  306. protected function getInlinedService()
  307. {
  308. $this->services['inlined'] = $instance = new \Bar();
  309. $instance->setBaz($this->get('baz'));
  310. $instance->pub = 'pub';
  311. return $instance;
  312. }
  313. /**
  314. * Gets the 'new_factory' service.
  315. *
  316. * This service is shared.
  317. * This method always returns the same instance of the service.
  318. *
  319. * This service is private.
  320. * If you want to be able to request this service from the container directly,
  321. * make it public, otherwise you might end up with broken code.
  322. *
  323. * @return \FactoryClass A FactoryClass instance.
  324. */
  325. protected function getNewFactoryService()
  326. {
  327. $this->services['new_factory'] = $instance = new \FactoryClass();
  328. $instance->foo = 'bar';
  329. return $instance;
  330. }
  331. /**
  332. * Gets the default parameters.
  333. *
  334. * @return array An array of the default parameters
  335. */
  336. protected function getDefaultParameters()
  337. {
  338. return array(
  339. 'baz_class' => 'BazClass',
  340. 'foo_class' => 'Bar\\FooClass',
  341. 'foo' => 'bar',
  342. );
  343. }
  344. }