PageRenderTime 48ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

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

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