services_inline_requires.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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\FrozenParameterBag;
  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. $dir = __DIR__;
  22. for ($i = 1; $i <= 5; ++$i) {
  23. $this->targetDirs[$i] = $dir = \dirname($dir);
  24. }
  25. $this->parameters = $this->getDefaultParameters();
  26. $this->services = array();
  27. $this->normalizedIds = array(
  28. 'symfony\\component\\dependencyinjection\\tests\\fixtures\\includes\\hotpath\\c1' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C1',
  29. 'symfony\\component\\dependencyinjection\\tests\\fixtures\\includes\\hotpath\\c2' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2',
  30. 'symfony\\component\\dependencyinjection\\tests\\fixtures\\includes\\hotpath\\c3' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3',
  31. 'symfony\\component\\dependencyinjection\\tests\\fixtures\\parentnotexists' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\ParentNotExists',
  32. );
  33. $this->methodMap = array(
  34. 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\ParentNotExists' => 'getParentNotExistsService',
  35. 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C1' => 'getC1Service',
  36. 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2' => 'getC2Service',
  37. 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => 'getC3Service',
  38. );
  39. $this->privates = array(
  40. 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => true,
  41. );
  42. $this->aliases = array();
  43. $this->privates['service_container'] = function () {
  44. include_once $this->targetDirs[1].'/includes/HotPath/I1.php';
  45. include_once $this->targetDirs[1].'/includes/HotPath/P1.php';
  46. include_once $this->targetDirs[1].'/includes/HotPath/T1.php';
  47. include_once $this->targetDirs[1].'/includes/HotPath/C1.php';
  48. };
  49. }
  50. public function getRemovedIds()
  51. {
  52. return array(
  53. 'Psr\\Container\\ContainerInterface' => true,
  54. 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
  55. 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => true,
  56. );
  57. }
  58. public function compile()
  59. {
  60. throw new LogicException('You cannot compile a dumped container that was already compiled.');
  61. }
  62. public function isCompiled()
  63. {
  64. return true;
  65. }
  66. public function isFrozen()
  67. {
  68. @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED);
  69. return true;
  70. }
  71. /**
  72. * Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists' shared service.
  73. *
  74. * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists
  75. */
  76. protected function getParentNotExistsService()
  77. {
  78. return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists();
  79. }
  80. /**
  81. * Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C1' shared service.
  82. *
  83. * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C1
  84. */
  85. protected function getC1Service()
  86. {
  87. return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C1'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C1();
  88. }
  89. /**
  90. * Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2' shared service.
  91. *
  92. * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2
  93. */
  94. protected function getC2Service()
  95. {
  96. include_once $this->targetDirs[1].'/includes/HotPath/C2.php';
  97. include_once $this->targetDirs[1].'/includes/HotPath/C3.php';
  98. return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3'] : $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3()) && false ?: '_'});
  99. }
  100. /**
  101. * Gets the private 'Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3' shared service.
  102. *
  103. * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3
  104. */
  105. protected function getC3Service()
  106. {
  107. include_once $this->targetDirs[1].'/includes/HotPath/C3.php';
  108. return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3();
  109. }
  110. public function getParameter($name)
  111. {
  112. $name = (string) $name;
  113. if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
  114. $name = $this->normalizeParameterName($name);
  115. if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
  116. throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
  117. }
  118. }
  119. if (isset($this->loadedDynamicParameters[$name])) {
  120. return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
  121. }
  122. return $this->parameters[$name];
  123. }
  124. public function hasParameter($name)
  125. {
  126. $name = (string) $name;
  127. $name = $this->normalizeParameterName($name);
  128. return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters);
  129. }
  130. public function setParameter($name, $value)
  131. {
  132. throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
  133. }
  134. public function getParameterBag()
  135. {
  136. if (null === $this->parameterBag) {
  137. $parameters = $this->parameters;
  138. foreach ($this->loadedDynamicParameters as $name => $loaded) {
  139. $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
  140. }
  141. $this->parameterBag = new FrozenParameterBag($parameters);
  142. }
  143. return $this->parameterBag;
  144. }
  145. private $loadedDynamicParameters = array();
  146. private $dynamicParameters = array();
  147. /**
  148. * Computes a dynamic parameter.
  149. *
  150. * @param string The name of the dynamic parameter to load
  151. *
  152. * @return mixed The value of the dynamic parameter
  153. *
  154. * @throws InvalidArgumentException When the dynamic parameter does not exist
  155. */
  156. private function getDynamicParameter($name)
  157. {
  158. throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name));
  159. }
  160. private $normalizedParameterNames = array();
  161. private function normalizeParameterName($name)
  162. {
  163. if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) {
  164. $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName;
  165. if ((string) $name !== $normalizedName) {
  166. @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED);
  167. }
  168. } else {
  169. $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name;
  170. }
  171. return $normalizedName;
  172. }
  173. /**
  174. * Gets the default parameters.
  175. *
  176. * @return array An array of the default parameters
  177. */
  178. protected function getDefaultParameters()
  179. {
  180. return array(
  181. 'inline_requires' => true,
  182. );
  183. }
  184. }