Added the Search API Synonym module to deal specifically with licence and license...
[yaffs-website] / vendor / symfony / dependency-injection / Tests / Fixtures / php / services19.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 ProjectServiceContainer 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->methodMap = array(
28             'service_from_anonymous_factory' => 'getServiceFromAnonymousFactoryService',
29             'service_with_method_call_and_factory' => 'getServiceWithMethodCallAndFactoryService',
30         );
31
32         $this->aliases = array();
33     }
34
35     public function getRemovedIds()
36     {
37         return array(
38             'Psr\\Container\\ContainerInterface' => true,
39             'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
40         );
41     }
42
43     public function compile()
44     {
45         throw new LogicException('You cannot compile a dumped container that was already compiled.');
46     }
47
48     public function isCompiled()
49     {
50         return true;
51     }
52
53     public function isFrozen()
54     {
55         @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);
56
57         return true;
58     }
59
60     /**
61      * Gets the public 'service_from_anonymous_factory' shared service.
62      *
63      * @return object A %env(FOO)% instance
64      */
65     protected function getServiceFromAnonymousFactoryService()
66     {
67         return $this->services['service_from_anonymous_factory'] = (new ${($_ = $this->getEnv('FOO')) && false ?: "_"}())->getInstance();
68     }
69
70     /**
71      * Gets the public 'service_with_method_call_and_factory' shared service.
72      *
73      * @return \Bar\FooClass
74      */
75     protected function getServiceWithMethodCallAndFactoryService()
76     {
77         $this->services['service_with_method_call_and_factory'] = $instance = new \Bar\FooClass();
78
79         $instance->setBar(\Bar\FooClass::getInstance());
80
81         return $instance;
82     }
83
84     public function getParameter($name)
85     {
86         $name = (string) $name;
87         if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
88             $name = $this->normalizeParameterName($name);
89
90             if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
91                 throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
92             }
93         }
94         if (isset($this->loadedDynamicParameters[$name])) {
95             return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
96         }
97
98         return $this->parameters[$name];
99     }
100
101     public function hasParameter($name)
102     {
103         $name = (string) $name;
104         $name = $this->normalizeParameterName($name);
105
106         return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters);
107     }
108
109     public function setParameter($name, $value)
110     {
111         throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
112     }
113
114     public function getParameterBag()
115     {
116         if (null === $this->parameterBag) {
117             $parameters = $this->parameters;
118             foreach ($this->loadedDynamicParameters as $name => $loaded) {
119                 $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
120             }
121             $this->parameterBag = new FrozenParameterBag($parameters);
122         }
123
124         return $this->parameterBag;
125     }
126
127     private $loadedDynamicParameters = array(
128         'foo' => false,
129     );
130     private $dynamicParameters = array();
131
132     /**
133      * Computes a dynamic parameter.
134      *
135      * @param string The name of the dynamic parameter to load
136      *
137      * @return mixed The value of the dynamic parameter
138      *
139      * @throws InvalidArgumentException When the dynamic parameter does not exist
140      */
141     private function getDynamicParameter($name)
142     {
143         switch ($name) {
144             case 'foo': $value = $this->getEnv('FOO'); break;
145             default: throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name));
146         }
147         $this->loadedDynamicParameters[$name] = true;
148
149         return $this->dynamicParameters[$name] = $value;
150     }
151
152     private $normalizedParameterNames = array(
153         'env(foo)' => 'env(FOO)',
154     );
155
156     private function normalizeParameterName($name)
157     {
158         if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) {
159             $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName;
160             if ((string) $name !== $normalizedName) {
161                 @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);
162             }
163         } else {
164             $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name;
165         }
166
167         return $normalizedName;
168     }
169
170     /**
171      * Gets the default parameters.
172      *
173      * @return array An array of the default parameters
174      */
175     protected function getDefaultParameters()
176     {
177         return array(
178             'env(FOO)' => 'Bar\\FaooClass',
179         );
180     }
181 }