services_rot13_env.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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 Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container
  16. {
  17. private $parameters;
  18. private $targetDirs = array();
  19. public function __construct()
  20. {
  21. $this->parameters = $this->getDefaultParameters();
  22. $this->services = array();
  23. $this->normalizedIds = array(
  24. 'symfony\\component\\dependencyinjection\\tests\\dumper\\rot13envvarprocessor' => 'Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor',
  25. );
  26. $this->methodMap = array(
  27. 'Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor' => 'getRot13EnvVarProcessorService',
  28. 'container.env_var_processors_locator' => 'getContainer_EnvVarProcessorsLocatorService',
  29. );
  30. $this->aliases = array();
  31. }
  32. public function getRemovedIds()
  33. {
  34. return array(
  35. 'Psr\\Container\\ContainerInterface' => true,
  36. 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
  37. );
  38. }
  39. public function compile()
  40. {
  41. throw new LogicException('You cannot compile a dumped container that was already compiled.');
  42. }
  43. public function isCompiled()
  44. {
  45. return true;
  46. }
  47. public function isFrozen()
  48. {
  49. @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);
  50. return true;
  51. }
  52. /**
  53. * Gets the public 'Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor' shared service.
  54. *
  55. * @return \Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor
  56. */
  57. protected function getRot13EnvVarProcessorService()
  58. {
  59. return $this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] = new \Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor();
  60. }
  61. /**
  62. * Gets the public 'container.env_var_processors_locator' shared service.
  63. *
  64. * @return \Symfony\Component\DependencyInjection\ServiceLocator
  65. */
  66. protected function getContainer_EnvVarProcessorsLocatorService()
  67. {
  68. return $this->services['container.env_var_processors_locator'] = new \Symfony\Component\DependencyInjection\ServiceLocator(array('rot13' => function () {
  69. return ${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] : $this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] = new \Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor()) && false ?: '_'};
  70. }));
  71. }
  72. public function getParameter($name)
  73. {
  74. $name = (string) $name;
  75. if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
  76. $name = $this->normalizeParameterName($name);
  77. if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
  78. throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
  79. }
  80. }
  81. if (isset($this->loadedDynamicParameters[$name])) {
  82. return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
  83. }
  84. return $this->parameters[$name];
  85. }
  86. public function hasParameter($name)
  87. {
  88. $name = (string) $name;
  89. $name = $this->normalizeParameterName($name);
  90. return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters);
  91. }
  92. public function setParameter($name, $value)
  93. {
  94. throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
  95. }
  96. public function getParameterBag()
  97. {
  98. if (null === $this->parameterBag) {
  99. $parameters = $this->parameters;
  100. foreach ($this->loadedDynamicParameters as $name => $loaded) {
  101. $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
  102. }
  103. $this->parameterBag = new FrozenParameterBag($parameters);
  104. }
  105. return $this->parameterBag;
  106. }
  107. private $loadedDynamicParameters = array(
  108. 'hello' => false,
  109. );
  110. private $dynamicParameters = array();
  111. /**
  112. * Computes a dynamic parameter.
  113. *
  114. * @param string The name of the dynamic parameter to load
  115. *
  116. * @return mixed The value of the dynamic parameter
  117. *
  118. * @throws InvalidArgumentException When the dynamic parameter does not exist
  119. */
  120. private function getDynamicParameter($name)
  121. {
  122. switch ($name) {
  123. case 'hello': $value = $this->getEnv('rot13:foo'); break;
  124. default: throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name));
  125. }
  126. $this->loadedDynamicParameters[$name] = true;
  127. return $this->dynamicParameters[$name] = $value;
  128. }
  129. private $normalizedParameterNames = array();
  130. private function normalizeParameterName($name)
  131. {
  132. if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) {
  133. $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName;
  134. if ((string) $name !== $normalizedName) {
  135. @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);
  136. }
  137. } else {
  138. $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name;
  139. }
  140. return $normalizedName;
  141. }
  142. /**
  143. * Gets the default parameters.
  144. *
  145. * @return array An array of the default parameters
  146. */
  147. protected function getDefaultParameters()
  148. {
  149. return array(
  150. 'env(foo)' => 'jbeyq',
  151. );
  152. }
  153. }