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;
12 * This class has been auto-generated
13 * by the Symfony Dependency Injection Component.
15 * @final since Symfony 3.3
17 class ProjectServiceContainer extends Container
20 private $targetDirs = array();
22 public function __construct()
25 for ($i = 1; $i <= 5; ++$i) {
26 $this->targetDirs[$i] = $dir = \dirname($dir);
28 $this->parameters = $this->getDefaultParameters();
30 $this->services = array();
31 $this->methodMap = array(
32 'bar' => 'getBarService',
35 $this->aliases = array();
38 public function getRemovedIds()
41 'Psr\\Container\\ContainerInterface' => true,
42 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
46 public function compile()
48 throw new LogicException('You cannot compile a dumped container that was already compiled.');
51 public function isCompiled()
56 public function isFrozen()
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);
64 * Gets the public 'bar' shared service.
68 protected function getBarService()
70 $this->services['bar'] = $instance = new \BarClass();
72 $instance->setBaz($this->parameters['array_1'], $this->getParameter('array_2'), '%array_1%', $this->parameters['array_1']);
77 public function getParameter($name)
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);
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));
87 if (isset($this->loadedDynamicParameters[$name])) {
88 return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name);
91 return $this->parameters[$name];
94 public function hasParameter($name)
96 $name = (string) $name;
97 $name = $this->normalizeParameterName($name);
99 return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters);
102 public function setParameter($name, $value)
104 throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
107 public function getParameterBag()
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);
114 $this->parameterBag = new FrozenParameterBag($parameters);
117 return $this->parameterBag;
120 private $loadedDynamicParameters = array(
123 private $dynamicParameters = array();
126 * Computes a dynamic parameter.
128 * @param string The name of the dynamic parameter to load
130 * @return mixed The value of the dynamic parameter
132 * @throws InvalidArgumentException When the dynamic parameter does not exist
134 private function getDynamicParameter($name)
137 case 'array_2': $value = array(
138 0 => ($this->targetDirs[2].'/Dumper'),
140 default: throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name));
142 $this->loadedDynamicParameters[$name] = true;
144 return $this->dynamicParameters[$name] = $value;
147 private $normalizedParameterNames = array();
149 private function normalizeParameterName($name)
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);
157 $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name;
160 return $normalizedName;
164 * Gets the default parameters.
166 * @return array An array of the default parameters
168 protected function getDefaultParameters()