Added the Search API Synonym module to deal specifically with licence and license...
[yaffs-website] / vendor / symfony / dependency-injection / Tests / Fixtures / php / services_rot13_env.php
1 <?php
2
3 use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
4 use Symfony\Component\DependencyInjection\ContainerInterface;
5 use Symfony\Component\DependencyInjection\Container;
6 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
7 use Symfony\Component\DependencyInjection\Exception\LogicException;
8 use Symfony\Component\DependencyInjection\Exception\RuntimeException;
9 use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
10
11 /**
12  * This class has been auto-generated
13  * by the Symfony Dependency Injection Component.
14  *
15  * @final since Symfony 3.3
16  */
17 class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container
18 {
19     private $parameters;
20     private $targetDirs = array();
21
22     public function __construct()
23     {
24         $this->parameters = $this->getDefaultParameters();
25
26         $this->services = array();
27         $this->normalizedIds = array(
28             'symfony\\component\\dependencyinjection\\tests\\dumper\\rot13envvarprocessor' => 'Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor',
29         );
30         $this->methodMap = array(
31             'Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor' => 'getRot13EnvVarProcessorService',
32             'container.env_var_processors_locator' => 'getContainer_EnvVarProcessorsLocatorService',
33         );
34
35         $this->aliases = array();
36     }
37
38     public function getRemovedIds()
39     {
40         return array(
41             'Psr\\Container\\ContainerInterface' => true,
42             'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
43         );
44     }
45
46     public function compile()
47     {
48         throw new LogicException('You cannot compile a dumped container that was already compiled.');
49     }
50
51     public function isCompiled()
52     {
53         return true;
54     }
55
56     public function isFrozen()
57     {
58         @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);
59
60         return true;
61     }
62
63     /**
64      * Gets the public 'Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor' shared service.
65      *
66      * @return \Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor
67      */
68     protected function getRot13EnvVarProcessorService()
69     {
70         return $this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] = new \Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor();
71     }
72
73     /**
74      * Gets the public 'container.env_var_processors_locator' shared service.
75      *
76      * @return \Symfony\Component\DependencyInjection\ServiceLocator
77      */
78     protected function getContainer_EnvVarProcessorsLocatorService()
79     {
80         return $this->services['container.env_var_processors_locator'] = new \Symfony\Component\DependencyInjection\ServiceLocator(array('rot13' => function () {
81             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 ?: '_'};
82         }));
83     }
84
85     public function getParameter($name)
86     {
87         $name = (string) $name;
88         if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
89             $name = $this->normalizeParameterName($name);
90
91             if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
92                 throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
93             }
94         }
95         if (isset($this->loadedDynamicParameters[$name])) {
96             return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
97         }
98
99         return $this->parameters[$name];
100     }
101
102     public function hasParameter($name)
103     {
104         $name = (string) $name;
105         $name = $this->normalizeParameterName($name);
106
107         return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters);
108     }
109
110     public function setParameter($name, $value)
111     {
112         throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
113     }
114
115     public function getParameterBag()
116     {
117         if (null === $this->parameterBag) {
118             $parameters = $this->parameters;
119             foreach ($this->loadedDynamicParameters as $name => $loaded) {
120                 $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
121             }
122             $this->parameterBag = new FrozenParameterBag($parameters);
123         }
124
125         return $this->parameterBag;
126     }
127
128     private $loadedDynamicParameters = array(
129         'hello' => false,
130     );
131     private $dynamicParameters = array();
132
133     /**
134      * Computes a dynamic parameter.
135      *
136      * @param string The name of the dynamic parameter to load
137      *
138      * @return mixed The value of the dynamic parameter
139      *
140      * @throws InvalidArgumentException When the dynamic parameter does not exist
141      */
142     private function getDynamicParameter($name)
143     {
144         switch ($name) {
145             case 'hello': $value = $this->getEnv('rot13:foo'); break;
146             default: throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name));
147         }
148         $this->loadedDynamicParameters[$name] = true;
149
150         return $this->dynamicParameters[$name] = $value;
151     }
152
153     private $normalizedParameterNames = array();
154
155     private function normalizeParameterName($name)
156     {
157         if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) {
158             $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName;
159             if ((string) $name !== $normalizedName) {
160                 @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);
161             }
162         } else {
163             $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name;
164         }
165
166         return $normalizedName;
167     }
168
169     /**
170      * Gets the default parameters.
171      *
172      * @return array An array of the default parameters
173      */
174     protected function getDefaultParameters()
175     {
176         return array(
177             'env(foo)' => 'jbeyq',
178         );
179     }
180 }