Added the Search API Synonym module to deal specifically with licence and license...
[yaffs-website] / vendor / symfony / dependency-injection / Tests / Fixtures / php / services_array_params.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         $dir = __DIR__;
25         for ($i = 1; $i <= 5; ++$i) {
26             $this->targetDirs[$i] = $dir = \dirname($dir);
27         }
28         $this->parameters = $this->getDefaultParameters();
29
30         $this->services = array();
31         $this->methodMap = array(
32             'bar' => 'getBarService',
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 'bar' shared service.
65      *
66      * @return \BarClass
67      */
68     protected function getBarService()
69     {
70         $this->services['bar'] = $instance = new \BarClass();
71
72         $instance->setBaz($this->parameters['array_1'], $this->getParameter('array_2'), '%array_1%', $this->parameters['array_1']);
73
74         return $instance;
75     }
76
77     public function getParameter($name)
78     {
79         $name = (string) $name;
80         if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
81             $name = $this->normalizeParameterName($name);
82
83             if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
84                 throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
85             }
86         }
87         if (isset($this->loadedDynamicParameters[$name])) {
88             return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
89         }
90
91         return $this->parameters[$name];
92     }
93
94     public function hasParameter($name)
95     {
96         $name = (string) $name;
97         $name = $this->normalizeParameterName($name);
98
99         return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters);
100     }
101
102     public function setParameter($name, $value)
103     {
104         throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
105     }
106
107     public function getParameterBag()
108     {
109         if (null === $this->parameterBag) {
110             $parameters = $this->parameters;
111             foreach ($this->loadedDynamicParameters as $name => $loaded) {
112                 $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
113             }
114             $this->parameterBag = new FrozenParameterBag($parameters);
115         }
116
117         return $this->parameterBag;
118     }
119
120     private $loadedDynamicParameters = array(
121         'array_2' => false,
122     );
123     private $dynamicParameters = array();
124
125     /**
126      * Computes a dynamic parameter.
127      *
128      * @param string The name of the dynamic parameter to load
129      *
130      * @return mixed The value of the dynamic parameter
131      *
132      * @throws InvalidArgumentException When the dynamic parameter does not exist
133      */
134     private function getDynamicParameter($name)
135     {
136         switch ($name) {
137             case 'array_2': $value = array(
138                 0 => ($this->targetDirs[2].'/Dumper'),
139             ); break;
140             default: throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name));
141         }
142         $this->loadedDynamicParameters[$name] = true;
143
144         return $this->dynamicParameters[$name] = $value;
145     }
146
147     private $normalizedParameterNames = array();
148
149     private function normalizeParameterName($name)
150     {
151         if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) {
152             $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName;
153             if ((string) $name !== $normalizedName) {
154                 @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);
155             }
156         } else {
157             $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name;
158         }
159
160         return $normalizedName;
161     }
162
163     /**
164      * Gets the default parameters.
165      *
166      * @return array An array of the default parameters
167      */
168     protected function getDefaultParameters()
169     {
170         return array(
171             'array_1' => array(
172                 0 => 123,
173             ),
174         );
175     }
176 }