PluginProbe ʕ •ᴥ•ʔ
MailPoet – Newsletters, Email Marketing, and Automation / 5.36.0
MailPoet – Newsletters, Email Marketing, and Automation v5.36.0
5.36.0 5.35.1 5.35.0 5.34.3 5.34.2 5.34.1 5.34.0 5.33.1 5.33.0 5.32.0 5.31.0 5.30.0 5.29.0 5.28.1 5.28.0 5.27.0 5.26.0 5.26.1 5.25.0 5.24.0 4.43.0 4.43.1 4.44.0 4.44.1 4.45.0 4.46.0 4.47.0 4.48.0 4.48.1 4.48.2 4.49.0 4.49.1 4.5.0 4.5.1 4.5.2 4.50.0 4.50.1 4.51.0 4.51.1 4.51.2 4.52.0 4.53.0 4.54.0 4.55.0 4.56.0 4.57.0 4.58.0 4.58.1 4.58.2 4.6.0 4.6.1 4.6.2 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 5.0.0 5.0.1 5.0.2 5.1.0 5.1.1 5.10.0 5.10.1 5.11.0 5.12.0 5.12.1 5.12.10 5.12.11 5.12.12 5.12.13 5.12.2 5.12.3 5.12.4 5.12.5 5.12.6 5.12.7 5.12.8 5.12.9 5.13.0 5.13.1 5.13.2 5.14.0 5.14.1 5.14.2 5.14.3 5.15.0 5.15.1 5.16.0 5.16.1 5.16.2 5.16.3 5.16.4 5.17.0 5.17.1 5.17.2 5.17.3 5.17.4 5.17.5 5.17.6 5.18.0 5.19.0 5.2.0 5.2.1 5.2.2 5.2.3 5.20.0 5.21.0 5.21.1 5.21.2 5.21.3 5.22.0 5.22.1 5.22.2 5.22.3 5.22.4 5.23.0 5.23.1 5.23.2 5.3.0 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.3.7 5.4.0 5.4.1 5.4.2 5.5.0 5.5.1 5.5.2 5.6.0 5.6.1 5.6.2 5.6.3 5.6.4 5.7.0 5.7.1 5.8.0 5.8.1 5.9.0 3.0.0-beta.15 3.7.1 3.0.0-beta.16 3.7.2 3.0.0-beta.17 3.7.3 3.0.0-beta.18 3.7.4 3.0.0-beta.19 3.7.5 3.0.0-beta.2 3.7.6 3.0.0-beta.20 3.7.8 3.0.0-beta.21 3.70.0 3.0.0-beta.22 3.71.0 3.0.0-beta.23 3.71.1 3.0.0-beta.23.1 3.71.2 3.0.0-beta.23.2 3.71.3 3.0.0-beta.24 3.72.0 3.0.0-beta.25 3.73.0 3.0.0-beta.26 3.73.1 3.0.0-beta.27 3.73.2 3.0.0-beta.28 3.74.0 3.0.0-beta.29 3.74.1 3.0.0-beta.3 3.74.2 3.0.0-beta.30 3.74.3 3.0.0-beta.31 3.75.0 3.0.0-beta.32 3.75.1 3.0.0-beta.33 3.76.0 3.0.0-beta.33.1 3.77.0 3.0.0-beta.34.0.0 3.77.1 3.0.0-beta.36.0.0 3.78.0 3.0.0-beta.36.0.1 3.79.0 3.0.0-beta.36.2.0 3.8 3.0.0-beta.36.3.0 3.8.1 3.0.0-beta.36.3.1 3.8.2 3.0.0-beta.37.0.0 3.8.3 3.0.0-beta.4 3.8.4 3.0.0-beta.5 3.8.5 3.0.0-beta.6 3.8.6 3.0.0-beta.7 3.80.0 3.0.0-beta.7.1 3.81.0 3.0.0-beta.8 3.82.0 3.0.0-beta.9 3.83.0 3.0.0-rc.1.0.0 3.84.0 3.0.0-rc.1.0.1 3.84.1 3.0.0-rc.1.0.2 3.85.0 3.0.0-rc.1.0.3 3.85.1 3.0.0-rc.1.0.4 3.86.0 3.0.0-rc.2.0.0 3.87.0 3.0.0-rc.2.0.1 3.87.1 3.0.0-rc.2.0.2 3.87.2 3.0.0-rc.2.0.3 3.88.0 3.0.1 3.88.1 3.0.2 3.88.2 3.0.3 3.89.0 3.0.4 3.89.1 3.0.5 3.89.2 3.0.6 3.89.3 3.0.7 3.89.4 3.0.8 3.9.0 3.0.9 3.9.1 3.1.0 3.90.0 3.10 3.90.1 3.10.1 3.90.2 3.100.0 3.91.0 3.100.1 3.91.1 3.100.2 3.92.0 3.101.0 3.92.1 3.101.1 3.93.0 3.102.0 3.93.1 3.102.1 3.94.0 3.103.0 3.95.0 3.103.1 3.95.1 3.11.0 3.96.0 3.11.1 3.96.1 3.11.2 3.97.0 3.11.3 3.98.0 3.11.4 3.98.1 3.11.5 3.99.0 3.12.0 3.99.1 3.12.1 4.0.0 3.13.0 4.0.1 3.14.0 4.1.0 3.14.1 4.1.1 3.15.0 4.10.0 3.16.0 4.11.0 3.16.1 4.11.1 3.16.2 4.12.0 3.16.3 4.12.1 3.17.0 4.12.2 3.17.1 4.13.0 3.17.2 4.14.0 3.18.0 4.15.0 3.18.1 4.16.0 3.18.2 4.17.0 3.19.0 4.17.1 3.19.1 4.18.0 3.19.2 4.18.1 3.19.3 4.19.0 3.2.0 4.2.0 3.2.1 4.20.0 3.2.2 4.20.1 3.2.3 4.20.2 3.2.4 4.21.0 3.2.5 4.22.0 3.20.0 4.22.1 3.21.0 4.22.2 3.21.1 4.23.0 3.22.0 4.24.0 3.23.0 4.25.0 3.23.1 4.26.0 3.23.2 4.26.1 3.24.0 4.27.0 3.25.0 4.28.0 3.25.1 4.29.0 3.26.0 4.3.0 3.26.1 4.3.1 3.27.0 4.30.0 3.28.0 4.31.0 3.29.0 4.31.1 3.3.0 4.32.0 3.3.1 4.33.0 3.3.2 4.34.0 3.3.3 4.35.0 3.3.4 4.35.1 3.3.5 4.36.0 3.3.6 4.37.0 3.30.0 4.38.0 3.31.0 4.39.0 3.31.1 4.4.0 3.32.0 4.40.0 3.32.1 4.41.0 3.32.2 4.41.1 3.33.0 4.41.2 3.34.0 4.41.3 3.34.1 4.42.0 3.34.2 4.42.1 3.34.3 3.34.4 3.35.0 3.35.1 3.35.3 3.35.4 3.36.0 3.37.0 3.37.1 3.37.2 3.37.3 3.38.0 3.38.1 3.39.0 3.39.1 3.39.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.40.0 3.40.1 3.41.0 3.41.1 3.41.2 3.42.0 3.42.1 3.42.2 3.42.3 3.43.0 3.43.1 3.44.0 3.45.0 3.45.1 3.46.0 3.46.1 3.46.10 3.46.11 3.46.12 3.46.13 3.46.14 3.46.2 3.46.3 3.46.4 3.46.5 3.46.6 3.46.7 3.46.8 3.46.9 3.47.0 3.47.1 3.47.10 3.47.11 3.47.2 3.47.3 3.47.5 3.47.6 3.47.7 3.47.9 3.48.0 3.48.1 3.49.0 3.49.1 3.5.0 3.5.1 3.50.0 3.51.0 3.51.1 3.51.2 3.52.0 3.53.0 3.54.0 3.54.1 3.54.2 3.54.3 3.55.0 3.55.1 3.56.0 3.56.1 3.56.2 3.57.0 3.57.1 3.58.0 3.59.0 3.59.1 3.59.2 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.60.0 3.60.1 3.60.10 3.60.11 3.60.12 3.60.2 3.60.3 3.60.4 3.60.6 3.60.7 3.60.8 3.60.9 3.61.0 3.62.0 3.62.1 3.63.0 3.64.0 3.64.1 3.64.2 3.64.3 3.65.0 trunk 3.65.1 3.0.0 3.66.0 3.0.0-beta.1 3.67.0 3.0.0-beta.10 3.67.1 3.0.0-beta.11 3.68.0 3.0.0-beta.12 3.69.0 3.0.0-beta.13 3.69.1 3.0.0-beta.14 3.7.0
mailpoet / vendor-prefixed / symfony / dependency-injection / ContainerBuilder.php
mailpoet / vendor-prefixed / symfony / dependency-injection Last commit date
Argument 2 years ago Attribute 2 years ago Exception 2 years ago ParameterBag 3 years ago Alias.php 4 years ago ChildDefinition.php 4 years ago Container.php 2 years ago ContainerAwareInterface.php 2 years ago ContainerAwareTrait.php 2 years ago ContainerBuilder.php 2 years ago ContainerInterface.php 4 years ago Definition.php 2 years ago EnvVarLoaderInterface.php 4 years ago EnvVarProcessor.php 2 years ago EnvVarProcessorInterface.php 4 years ago ExpressionLanguage.php 2 years ago ExpressionLanguageProvider.php 2 years ago Parameter.php 4 years ago Reference.php 4 years ago ReverseContainer.php 2 years ago ServiceLocator.php 2 years ago TaggedContainerInterface.php 4 years ago TypedReference.php 2 years ago Variable.php 4 years ago index.php 3 years ago
ContainerBuilder.php
966 lines
1 <?php
2 namespace MailPoetVendor\Symfony\Component\DependencyInjection;
3 if (!defined('ABSPATH')) exit;
4 use MailPoetVendor\Composer\InstalledVersions;
5 use MailPoetVendor\Psr\Container\ContainerInterface as PsrContainerInterface;
6 use MailPoetVendor\Symfony\Component\Config\Resource\ClassExistenceResource;
7 use MailPoetVendor\Symfony\Component\Config\Resource\ComposerResource;
8 use MailPoetVendor\Symfony\Component\Config\Resource\DirectoryResource;
9 use MailPoetVendor\Symfony\Component\Config\Resource\FileExistenceResource;
10 use MailPoetVendor\Symfony\Component\Config\Resource\FileResource;
11 use MailPoetVendor\Symfony\Component\Config\Resource\GlobResource;
12 use MailPoetVendor\Symfony\Component\Config\Resource\ReflectionClassResource;
13 use MailPoetVendor\Symfony\Component\Config\Resource\ResourceInterface;
14 use MailPoetVendor\Symfony\Component\DependencyInjection\Argument\AbstractArgument;
15 use MailPoetVendor\Symfony\Component\DependencyInjection\Argument\IteratorArgument;
16 use MailPoetVendor\Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
17 use MailPoetVendor\Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
18 use MailPoetVendor\Symfony\Component\DependencyInjection\Argument\ServiceLocator;
19 use MailPoetVendor\Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
20 use MailPoetVendor\Symfony\Component\DependencyInjection\Attribute\Target;
21 use MailPoetVendor\Symfony\Component\DependencyInjection\Compiler\Compiler;
22 use MailPoetVendor\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
23 use MailPoetVendor\Symfony\Component\DependencyInjection\Compiler\PassConfig;
24 use MailPoetVendor\Symfony\Component\DependencyInjection\Compiler\ResolveEnvPlaceholdersPass;
25 use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\BadMethodCallException;
26 use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
27 use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\LogicException;
28 use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\RuntimeException;
29 use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
30 use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
31 use MailPoetVendor\Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
32 use MailPoetVendor\Symfony\Component\DependencyInjection\LazyProxy\Instantiator\InstantiatorInterface;
33 use MailPoetVendor\Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator;
34 use MailPoetVendor\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
35 use MailPoetVendor\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
36 use MailPoetVendor\Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
37 use MailPoetVendor\Symfony\Component\ExpressionLanguage\Expression;
38 use MailPoetVendor\Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
39 class ContainerBuilder extends Container implements TaggedContainerInterface
40 {
41 private $extensions = [];
42 private $extensionsByNs = [];
43 private $definitions = [];
44 private $aliasDefinitions = [];
45 private $resources = [];
46 private $extensionConfigs = [];
47 private $compiler;
48 private $trackResources;
49 private $proxyInstantiator;
50 private $expressionLanguage;
51 private $expressionLanguageProviders = [];
52 private $usedTags = [];
53 private $envPlaceholders = [];
54 private $envCounters = [];
55 private $vendors;
56 private $autoconfiguredInstanceof = [];
57 private $autoconfiguredAttributes = [];
58 private $removedIds = [];
59 private $removedBindingIds = [];
60 private const INTERNAL_TYPES = ['int' => \true, 'float' => \true, 'string' => \true, 'bool' => \true, 'resource' => \true, 'object' => \true, 'array' => \true, 'null' => \true, 'callable' => \true, 'iterable' => \true, 'mixed' => \true];
61 public function __construct(?ParameterBagInterface $parameterBag = null)
62 {
63 parent::__construct($parameterBag);
64 $this->trackResources = \interface_exists(ResourceInterface::class);
65 $this->setDefinition('service_container', (new Definition(ContainerInterface::class))->setSynthetic(\true)->setPublic(\true));
66 $this->setAlias(PsrContainerInterface::class, new Alias('service_container', \false))->setDeprecated('symfony/dependency-injection', '5.1', $deprecationMessage = 'The "%alias_id%" autowiring alias is deprecated. Define it explicitly in your app if you want to keep using it.');
67 $this->setAlias(ContainerInterface::class, new Alias('service_container', \false))->setDeprecated('symfony/dependency-injection', '5.1', $deprecationMessage);
68 }
69 private $classReflectors;
70 public function setResourceTracking(bool $track)
71 {
72 $this->trackResources = $track;
73 }
74 public function isTrackingResources()
75 {
76 return $this->trackResources;
77 }
78 public function setProxyInstantiator(InstantiatorInterface $proxyInstantiator)
79 {
80 $this->proxyInstantiator = $proxyInstantiator;
81 }
82 public function registerExtension(ExtensionInterface $extension)
83 {
84 $this->extensions[$extension->getAlias()] = $extension;
85 if (\false !== $extension->getNamespace()) {
86 $this->extensionsByNs[$extension->getNamespace()] = $extension;
87 }
88 }
89 public function getExtension(string $name)
90 {
91 if (isset($this->extensions[$name])) {
92 return $this->extensions[$name];
93 }
94 if (isset($this->extensionsByNs[$name])) {
95 return $this->extensionsByNs[$name];
96 }
97 throw new LogicException(\sprintf('Container extension "%s" is not registered.', $name));
98 }
99 public function getExtensions()
100 {
101 return $this->extensions;
102 }
103 public function hasExtension(string $name)
104 {
105 return isset($this->extensions[$name]) || isset($this->extensionsByNs[$name]);
106 }
107 public function getResources()
108 {
109 return \array_values($this->resources);
110 }
111 public function addResource(ResourceInterface $resource)
112 {
113 if (!$this->trackResources) {
114 return $this;
115 }
116 if ($resource instanceof GlobResource && $this->inVendors($resource->getPrefix())) {
117 return $this;
118 }
119 $this->resources[(string) $resource] = $resource;
120 return $this;
121 }
122 public function setResources(array $resources)
123 {
124 if (!$this->trackResources) {
125 return $this;
126 }
127 $this->resources = $resources;
128 return $this;
129 }
130 public function addObjectResource($object)
131 {
132 if ($this->trackResources) {
133 if (\is_object($object)) {
134 $object = \get_class($object);
135 }
136 if (!isset($this->classReflectors[$object])) {
137 $this->classReflectors[$object] = new \ReflectionClass($object);
138 }
139 $class = $this->classReflectors[$object];
140 foreach ($class->getInterfaceNames() as $name) {
141 if (null === ($interface =& $this->classReflectors[$name])) {
142 $interface = new \ReflectionClass($name);
143 }
144 $file = $interface->getFileName();
145 if (\false !== $file && \file_exists($file)) {
146 $this->fileExists($file);
147 }
148 }
149 do {
150 $file = $class->getFileName();
151 if (\false !== $file && \file_exists($file)) {
152 $this->fileExists($file);
153 }
154 foreach ($class->getTraitNames() as $name) {
155 $this->addObjectResource($name);
156 }
157 } while ($class = $class->getParentClass());
158 }
159 return $this;
160 }
161 public function getReflectionClass(?string $class, bool $throw = \true) : ?\ReflectionClass
162 {
163 if (!($class = $this->getParameterBag()->resolveValue($class))) {
164 return null;
165 }
166 if (isset(self::INTERNAL_TYPES[$class])) {
167 return null;
168 }
169 $resource = $classReflector = null;
170 try {
171 if (isset($this->classReflectors[$class])) {
172 $classReflector = $this->classReflectors[$class];
173 } elseif (\class_exists(ClassExistenceResource::class)) {
174 $resource = new ClassExistenceResource($class, \false);
175 $classReflector = $resource->isFresh(0) ? \false : new \ReflectionClass($class);
176 } else {
177 $classReflector = \class_exists($class) ? new \ReflectionClass($class) : \false;
178 }
179 } catch (\ReflectionException $e) {
180 if ($throw) {
181 throw $e;
182 }
183 }
184 if ($this->trackResources) {
185 if (!$classReflector) {
186 $this->addResource($resource ?? new ClassExistenceResource($class, \false));
187 } elseif (!$classReflector->isInternal()) {
188 $path = $classReflector->getFileName();
189 if (!$this->inVendors($path)) {
190 $this->addResource(new ReflectionClassResource($classReflector, $this->vendors));
191 }
192 }
193 $this->classReflectors[$class] = $classReflector;
194 }
195 return $classReflector ?: null;
196 }
197 public function fileExists(string $path, $trackContents = \true) : bool
198 {
199 $exists = \file_exists($path);
200 if (!$this->trackResources || $this->inVendors($path)) {
201 return $exists;
202 }
203 if (!$exists) {
204 $this->addResource(new FileExistenceResource($path));
205 return $exists;
206 }
207 if (\is_dir($path)) {
208 if ($trackContents) {
209 $this->addResource(new DirectoryResource($path, \is_string($trackContents) ? $trackContents : null));
210 } else {
211 $this->addResource(new GlobResource($path, '/*', \false));
212 }
213 } elseif ($trackContents) {
214 $this->addResource(new FileResource($path));
215 }
216 return $exists;
217 }
218 public function loadFromExtension(string $extension, ?array $values = null)
219 {
220 if ($this->isCompiled()) {
221 throw new BadMethodCallException('Cannot load from an extension on a compiled container.');
222 }
223 $namespace = $this->getExtension($extension)->getAlias();
224 $this->extensionConfigs[$namespace][] = $values ?? [];
225 return $this;
226 }
227 public function addCompilerPass(CompilerPassInterface $pass, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0)
228 {
229 $this->getCompiler()->addPass($pass, $type, $priority);
230 $this->addObjectResource($pass);
231 return $this;
232 }
233 public function getCompilerPassConfig()
234 {
235 return $this->getCompiler()->getPassConfig();
236 }
237 public function getCompiler()
238 {
239 if (null === $this->compiler) {
240 $this->compiler = new Compiler();
241 }
242 return $this->compiler;
243 }
244 public function set(string $id, ?object $service)
245 {
246 if ($this->isCompiled() && (isset($this->definitions[$id]) && !$this->definitions[$id]->isSynthetic())) {
247 // setting a synthetic service on a compiled container is alright
248 throw new BadMethodCallException(\sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a compiled container is not allowed.', $id));
249 }
250 unset($this->definitions[$id], $this->aliasDefinitions[$id], $this->removedIds[$id]);
251 parent::set($id, $service);
252 }
253 public function removeDefinition(string $id)
254 {
255 if (isset($this->definitions[$id])) {
256 unset($this->definitions[$id]);
257 $this->removedIds[$id] = \true;
258 }
259 }
260 public function has(string $id)
261 {
262 return isset($this->definitions[$id]) || isset($this->aliasDefinitions[$id]) || parent::has($id);
263 }
264 public function get(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
265 {
266 if ($this->isCompiled() && isset($this->removedIds[$id])) {
267 return ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $invalidBehavior ? parent::get($id) : null;
268 }
269 return $this->doGet($id, $invalidBehavior);
270 }
271 private function doGet(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, ?array &$inlineServices = null, bool $isConstructorArgument = \false)
272 {
273 if (isset($inlineServices[$id])) {
274 return $inlineServices[$id];
275 }
276 if (null === $inlineServices) {
277 $isConstructorArgument = \true;
278 $inlineServices = [];
279 }
280 try {
281 if (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $invalidBehavior) {
282 return $this->privates[$id] ?? parent::get($id, $invalidBehavior);
283 }
284 if (null !== ($service = $this->privates[$id] ?? parent::get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE))) {
285 return $service;
286 }
287 } catch (ServiceCircularReferenceException $e) {
288 if ($isConstructorArgument) {
289 throw $e;
290 }
291 }
292 if (!isset($this->definitions[$id]) && isset($this->aliasDefinitions[$id])) {
293 $alias = $this->aliasDefinitions[$id];
294 if ($alias->isDeprecated()) {
295 $deprecation = $alias->getDeprecation($id);
296 trigger_deprecation($deprecation['package'], $deprecation['version'], $deprecation['message']);
297 }
298 return $this->doGet((string) $alias, $invalidBehavior, $inlineServices, $isConstructorArgument);
299 }
300 try {
301 $definition = $this->getDefinition($id);
302 } catch (ServiceNotFoundException $e) {
303 if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE < $invalidBehavior) {
304 return null;
305 }
306 throw $e;
307 }
308 if ($definition->hasErrors() && ($e = $definition->getErrors())) {
309 throw new RuntimeException(\reset($e));
310 }
311 if ($isConstructorArgument) {
312 $this->loading[$id] = \true;
313 }
314 try {
315 return $this->createService($definition, $inlineServices, $isConstructorArgument, $id);
316 } finally {
317 if ($isConstructorArgument) {
318 unset($this->loading[$id]);
319 }
320 }
321 }
322 public function merge(self $container)
323 {
324 if ($this->isCompiled()) {
325 throw new BadMethodCallException('Cannot merge on a compiled container.');
326 }
327 $this->addDefinitions($container->getDefinitions());
328 $this->addAliases($container->getAliases());
329 $this->getParameterBag()->add($container->getParameterBag()->all());
330 if ($this->trackResources) {
331 foreach ($container->getResources() as $resource) {
332 $this->addResource($resource);
333 }
334 }
335 foreach ($this->extensions as $name => $extension) {
336 if (!isset($this->extensionConfigs[$name])) {
337 $this->extensionConfigs[$name] = [];
338 }
339 $this->extensionConfigs[$name] = \array_merge($this->extensionConfigs[$name], $container->getExtensionConfig($name));
340 }
341 if ($this->getParameterBag() instanceof EnvPlaceholderParameterBag && $container->getParameterBag() instanceof EnvPlaceholderParameterBag) {
342 $envPlaceholders = $container->getParameterBag()->getEnvPlaceholders();
343 $this->getParameterBag()->mergeEnvPlaceholders($container->getParameterBag());
344 } else {
345 $envPlaceholders = [];
346 }
347 foreach ($container->envCounters as $env => $count) {
348 if (!$count && !isset($envPlaceholders[$env])) {
349 continue;
350 }
351 if (!isset($this->envCounters[$env])) {
352 $this->envCounters[$env] = $count;
353 } else {
354 $this->envCounters[$env] += $count;
355 }
356 }
357 foreach ($container->getAutoconfiguredInstanceof() as $interface => $childDefinition) {
358 if (isset($this->autoconfiguredInstanceof[$interface])) {
359 throw new InvalidArgumentException(\sprintf('"%s" has already been autoconfigured and merge() does not support merging autoconfiguration for the same class/interface.', $interface));
360 }
361 $this->autoconfiguredInstanceof[$interface] = $childDefinition;
362 }
363 foreach ($container->getAutoconfiguredAttributes() as $attribute => $configurator) {
364 if (isset($this->autoconfiguredAttributes[$attribute])) {
365 throw new InvalidArgumentException(\sprintf('"%s" has already been autoconfigured and merge() does not support merging autoconfiguration for the same attribute.', $attribute));
366 }
367 $this->autoconfiguredAttributes[$attribute] = $configurator;
368 }
369 }
370 public function getExtensionConfig(string $name)
371 {
372 if (!isset($this->extensionConfigs[$name])) {
373 $this->extensionConfigs[$name] = [];
374 }
375 return $this->extensionConfigs[$name];
376 }
377 public function prependExtensionConfig(string $name, array $config)
378 {
379 if (!isset($this->extensionConfigs[$name])) {
380 $this->extensionConfigs[$name] = [];
381 }
382 \array_unshift($this->extensionConfigs[$name], $config);
383 }
384 public function compile(bool $resolveEnvPlaceholders = \false)
385 {
386 $compiler = $this->getCompiler();
387 if ($this->trackResources) {
388 foreach ($compiler->getPassConfig()->getPasses() as $pass) {
389 $this->addObjectResource($pass);
390 }
391 }
392 $bag = $this->getParameterBag();
393 if ($resolveEnvPlaceholders && $bag instanceof EnvPlaceholderParameterBag) {
394 $compiler->addPass(new ResolveEnvPlaceholdersPass(), PassConfig::TYPE_AFTER_REMOVING, -1000);
395 }
396 $compiler->compile($this);
397 foreach ($this->definitions as $id => $definition) {
398 if ($this->trackResources && $definition->isLazy()) {
399 $this->getReflectionClass($definition->getClass());
400 }
401 }
402 $this->extensionConfigs = [];
403 if ($bag instanceof EnvPlaceholderParameterBag) {
404 if ($resolveEnvPlaceholders) {
405 $this->parameterBag = new ParameterBag($this->resolveEnvPlaceholders($bag->all(), \true));
406 }
407 $this->envPlaceholders = $bag->getEnvPlaceholders();
408 }
409 parent::compile();
410 foreach ($this->definitions + $this->aliasDefinitions as $id => $definition) {
411 if (!$definition->isPublic() || $definition->isPrivate()) {
412 $this->removedIds[$id] = \true;
413 }
414 }
415 }
416 public function getServiceIds()
417 {
418 return \array_map('strval', \array_unique(\array_merge(\array_keys($this->getDefinitions()), \array_keys($this->aliasDefinitions), parent::getServiceIds())));
419 }
420 public function getRemovedIds()
421 {
422 return $this->removedIds;
423 }
424 public function addAliases(array $aliases)
425 {
426 foreach ($aliases as $alias => $id) {
427 $this->setAlias($alias, $id);
428 }
429 }
430 public function setAliases(array $aliases)
431 {
432 $this->aliasDefinitions = [];
433 $this->addAliases($aliases);
434 }
435 public function setAlias(string $alias, $id)
436 {
437 if ('' === $alias || '\\' === $alias[-1] || \strlen($alias) !== \strcspn($alias, "\x00\r\n'")) {
438 throw new InvalidArgumentException(\sprintf('Invalid alias id: "%s".', $alias));
439 }
440 if (\is_string($id)) {
441 $id = new Alias($id);
442 } elseif (!$id instanceof Alias) {
443 throw new InvalidArgumentException('$id must be a string, or an Alias object.');
444 }
445 if ($alias === (string) $id) {
446 throw new InvalidArgumentException(\sprintf('An alias cannot reference itself, got a circular reference on "%s".', $alias));
447 }
448 unset($this->definitions[$alias], $this->removedIds[$alias]);
449 return $this->aliasDefinitions[$alias] = $id;
450 }
451 public function removeAlias(string $alias)
452 {
453 if (isset($this->aliasDefinitions[$alias])) {
454 unset($this->aliasDefinitions[$alias]);
455 $this->removedIds[$alias] = \true;
456 }
457 }
458 public function hasAlias(string $id)
459 {
460 return isset($this->aliasDefinitions[$id]);
461 }
462 public function getAliases()
463 {
464 return $this->aliasDefinitions;
465 }
466 public function getAlias(string $id)
467 {
468 if (!isset($this->aliasDefinitions[$id])) {
469 throw new InvalidArgumentException(\sprintf('The service alias "%s" does not exist.', $id));
470 }
471 return $this->aliasDefinitions[$id];
472 }
473 public function register(string $id, ?string $class = null)
474 {
475 return $this->setDefinition($id, new Definition($class));
476 }
477 public function autowire(string $id, ?string $class = null)
478 {
479 return $this->setDefinition($id, (new Definition($class))->setAutowired(\true));
480 }
481 public function addDefinitions(array $definitions)
482 {
483 foreach ($definitions as $id => $definition) {
484 $this->setDefinition($id, $definition);
485 }
486 }
487 public function setDefinitions(array $definitions)
488 {
489 $this->definitions = [];
490 $this->addDefinitions($definitions);
491 }
492 public function getDefinitions()
493 {
494 return $this->definitions;
495 }
496 public function setDefinition(string $id, Definition $definition)
497 {
498 if ($this->isCompiled()) {
499 throw new BadMethodCallException('Adding definition to a compiled container is not allowed.');
500 }
501 if ('' === $id || '\\' === $id[-1] || \strlen($id) !== \strcspn($id, "\x00\r\n'")) {
502 throw new InvalidArgumentException(\sprintf('Invalid service id: "%s".', $id));
503 }
504 unset($this->aliasDefinitions[$id], $this->removedIds[$id]);
505 return $this->definitions[$id] = $definition;
506 }
507 public function hasDefinition(string $id)
508 {
509 return isset($this->definitions[$id]);
510 }
511 public function getDefinition(string $id)
512 {
513 if (!isset($this->definitions[$id])) {
514 throw new ServiceNotFoundException($id);
515 }
516 return $this->definitions[$id];
517 }
518 public function findDefinition(string $id)
519 {
520 $seen = [];
521 while (isset($this->aliasDefinitions[$id])) {
522 $id = (string) $this->aliasDefinitions[$id];
523 if (isset($seen[$id])) {
524 $seen = \array_values($seen);
525 $seen = \array_slice($seen, \array_search($id, $seen));
526 $seen[] = $id;
527 throw new ServiceCircularReferenceException($id, $seen);
528 }
529 $seen[$id] = $id;
530 }
531 return $this->getDefinition($id);
532 }
533 private function createService(Definition $definition, array &$inlineServices, bool $isConstructorArgument = \false, ?string $id = null, bool $tryProxy = \true)
534 {
535 if (null === $id && isset($inlineServices[$h = \spl_object_hash($definition)])) {
536 return $inlineServices[$h];
537 }
538 if ($definition instanceof ChildDefinition) {
539 throw new RuntimeException(\sprintf('Constructing service "%s" from a parent definition is not supported at build time.', $id));
540 }
541 if ($definition->isSynthetic()) {
542 throw new RuntimeException(\sprintf('You have requested a synthetic service ("%s"). The DIC does not know how to construct this service.', $id));
543 }
544 if ($definition->isDeprecated()) {
545 $deprecation = $definition->getDeprecation($id);
546 trigger_deprecation($deprecation['package'], $deprecation['version'], $deprecation['message']);
547 }
548 if ($tryProxy && $definition->isLazy() && !($tryProxy = !($proxy = $this->proxyInstantiator) || $proxy instanceof RealServiceInstantiator)) {
549 $proxy = $proxy->instantiateProxy($this, $definition, $id, function () use($definition, &$inlineServices, $id) {
550 return $this->createService($definition, $inlineServices, \true, $id, \false);
551 });
552 $this->shareService($definition, $proxy, $id, $inlineServices);
553 return $proxy;
554 }
555 $parameterBag = $this->getParameterBag();
556 if (null !== $definition->getFile()) {
557 require_once $parameterBag->resolveValue($definition->getFile());
558 }
559 $arguments = $this->doResolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments())), $inlineServices, $isConstructorArgument);
560 if (null !== ($factory = $definition->getFactory())) {
561 if (\is_array($factory)) {
562 $factory = [$this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices, $isConstructorArgument), $factory[1]];
563 } elseif (!\is_string($factory)) {
564 throw new RuntimeException(\sprintf('Cannot create service "%s" because of invalid factory.', $id));
565 }
566 }
567 if (null !== $id && $definition->isShared() && (isset($this->services[$id]) || isset($this->privates[$id])) && ($tryProxy || !$definition->isLazy())) {
568 return $this->services[$id] ?? $this->privates[$id];
569 }
570 if (!\array_is_list($arguments)) {
571 $arguments = \array_combine(\array_map(function ($k) {
572 return \preg_replace('/^.*\\$/', '', $k);
573 }, \array_keys($arguments)), $arguments);
574 }
575 if (null !== $factory) {
576 $service = $factory(...$arguments);
577 if (!$definition->isDeprecated() && \is_array($factory) && \is_string($factory[0])) {
578 $r = new \ReflectionClass($factory[0]);
579 if (0 < \strpos($r->getDocComment(), "\n * @deprecated ")) {
580 trigger_deprecation('', '', 'The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name);
581 }
582 }
583 } else {
584 $r = new \ReflectionClass($parameterBag->resolveValue($definition->getClass()));
585 $service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments);
586 if (!$definition->isDeprecated() && 0 < \strpos($r->getDocComment(), "\n * @deprecated ")) {
587 trigger_deprecation('', '', 'The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name);
588 }
589 }
590 $lastWitherIndex = null;
591 foreach ($definition->getMethodCalls() as $k => $call) {
592 if ($call[2] ?? \false) {
593 $lastWitherIndex = $k;
594 }
595 }
596 if (null === $lastWitherIndex && ($tryProxy || !$definition->isLazy())) {
597 // share only if proxying failed, or if not a proxy, and if no withers are found
598 $this->shareService($definition, $service, $id, $inlineServices);
599 }
600 $properties = $this->doResolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getProperties())), $inlineServices);
601 foreach ($properties as $name => $value) {
602 $service->{$name} = $value;
603 }
604 foreach ($definition->getMethodCalls() as $k => $call) {
605 $service = $this->callMethod($service, $call, $inlineServices);
606 if ($lastWitherIndex === $k && ($tryProxy || !$definition->isLazy())) {
607 // share only if proxying failed, or if not a proxy, and this is the last wither
608 $this->shareService($definition, $service, $id, $inlineServices);
609 }
610 }
611 if ($callable = $definition->getConfigurator()) {
612 if (\is_array($callable)) {
613 $callable[0] = $parameterBag->resolveValue($callable[0]);
614 if ($callable[0] instanceof Reference) {
615 $callable[0] = $this->doGet((string) $callable[0], $callable[0]->getInvalidBehavior(), $inlineServices);
616 } elseif ($callable[0] instanceof Definition) {
617 $callable[0] = $this->createService($callable[0], $inlineServices);
618 }
619 }
620 if (!\is_callable($callable)) {
621 throw new InvalidArgumentException(\sprintf('The configure callable for class "%s" is not a callable.', \get_debug_type($service)));
622 }
623 $callable($service);
624 }
625 return $service;
626 }
627 public function resolveServices($value)
628 {
629 return $this->doResolveServices($value);
630 }
631 private function doResolveServices($value, array &$inlineServices = [], bool $isConstructorArgument = \false)
632 {
633 if (\is_array($value)) {
634 foreach ($value as $k => $v) {
635 $value[$k] = $this->doResolveServices($v, $inlineServices, $isConstructorArgument);
636 }
637 } elseif ($value instanceof ServiceClosureArgument) {
638 $reference = $value->getValues()[0];
639 $value = function () use($reference) {
640 return $this->resolveServices($reference);
641 };
642 } elseif ($value instanceof IteratorArgument) {
643 $value = new RewindableGenerator(function () use($value, &$inlineServices) {
644 foreach ($value->getValues() as $k => $v) {
645 foreach (self::getServiceConditionals($v) as $s) {
646 if (!$this->has($s)) {
647 continue 2;
648 }
649 }
650 foreach (self::getInitializedConditionals($v) as $s) {
651 if (!$this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE, $inlineServices)) {
652 continue 2;
653 }
654 }
655 (yield $k => $this->doResolveServices($v, $inlineServices));
656 }
657 }, function () use($value) : int {
658 $count = 0;
659 foreach ($value->getValues() as $v) {
660 foreach (self::getServiceConditionals($v) as $s) {
661 if (!$this->has($s)) {
662 continue 2;
663 }
664 }
665 foreach (self::getInitializedConditionals($v) as $s) {
666 if (!$this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)) {
667 continue 2;
668 }
669 }
670 ++$count;
671 }
672 return $count;
673 });
674 } elseif ($value instanceof ServiceLocatorArgument) {
675 $refs = $types = [];
676 foreach ($value->getValues() as $k => $v) {
677 if ($v) {
678 $refs[$k] = [$v];
679 $types[$k] = $v instanceof TypedReference ? $v->getType() : '?';
680 }
681 }
682 $value = new ServiceLocator(\Closure::fromCallable([$this, 'resolveServices']), $refs, $types);
683 } elseif ($value instanceof Reference) {
684 $value = $this->doGet((string) $value, $value->getInvalidBehavior(), $inlineServices, $isConstructorArgument);
685 } elseif ($value instanceof Definition) {
686 $value = $this->createService($value, $inlineServices, $isConstructorArgument);
687 } elseif ($value instanceof Parameter) {
688 $value = $this->getParameter((string) $value);
689 } elseif ($value instanceof Expression) {
690 $value = $this->getExpressionLanguage()->evaluate($value, ['container' => $this]);
691 } elseif ($value instanceof AbstractArgument) {
692 throw new RuntimeException($value->getTextWithContext());
693 }
694 return $value;
695 }
696 public function findTaggedServiceIds(string $name, bool $throwOnAbstract = \false)
697 {
698 $this->usedTags[] = $name;
699 $tags = [];
700 foreach ($this->getDefinitions() as $id => $definition) {
701 if ($definition->hasTag($name)) {
702 if ($throwOnAbstract && $definition->isAbstract()) {
703 throw new InvalidArgumentException(\sprintf('The service "%s" tagged "%s" must not be abstract.', $id, $name));
704 }
705 $tags[$id] = $definition->getTag($name);
706 }
707 }
708 return $tags;
709 }
710 public function findTags()
711 {
712 $tags = [];
713 foreach ($this->getDefinitions() as $id => $definition) {
714 $tags[] = \array_keys($definition->getTags());
715 }
716 return \array_unique(\array_merge([], ...$tags));
717 }
718 public function findUnusedTags()
719 {
720 return \array_values(\array_diff($this->findTags(), $this->usedTags));
721 }
722 public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)
723 {
724 $this->expressionLanguageProviders[] = $provider;
725 }
726 public function getExpressionLanguageProviders()
727 {
728 return $this->expressionLanguageProviders;
729 }
730 public function registerForAutoconfiguration(string $interface)
731 {
732 if (!isset($this->autoconfiguredInstanceof[$interface])) {
733 $this->autoconfiguredInstanceof[$interface] = new ChildDefinition('');
734 }
735 return $this->autoconfiguredInstanceof[$interface];
736 }
737 public function registerAttributeForAutoconfiguration(string $attributeClass, callable $configurator) : void
738 {
739 $this->autoconfiguredAttributes[$attributeClass] = $configurator;
740 }
741 public function registerAliasForArgument(string $id, string $type, ?string $name = null) : Alias
742 {
743 $name = (new Target($name ?? $id))->name;
744 if (!\preg_match('/^[a-zA-Z_\\x7f-\\xff]/', $name)) {
745 throw new InvalidArgumentException(\sprintf('Invalid argument name "%s" for service "%s": the first character must be a letter.', $name, $id));
746 }
747 return $this->setAlias($type . ' $' . $name, $id);
748 }
749 public function getAutoconfiguredInstanceof()
750 {
751 return $this->autoconfiguredInstanceof;
752 }
753 public function getAutoconfiguredAttributes() : array
754 {
755 return $this->autoconfiguredAttributes;
756 }
757 public function resolveEnvPlaceholders($value, $format = null, ?array &$usedEnvs = null)
758 {
759 if (null === $format) {
760 $format = '%%env(%s)%%';
761 }
762 $bag = $this->getParameterBag();
763 if (\true === $format) {
764 $value = $bag->resolveValue($value);
765 }
766 if ($value instanceof Definition) {
767 $value = (array) $value;
768 }
769 if (\is_array($value)) {
770 $result = [];
771 foreach ($value as $k => $v) {
772 $result[\is_string($k) ? $this->resolveEnvPlaceholders($k, $format, $usedEnvs) : $k] = $this->resolveEnvPlaceholders($v, $format, $usedEnvs);
773 }
774 return $result;
775 }
776 if (!\is_string($value) || 38 > \strlen($value) || !\preg_match('/env[_(]/i', $value)) {
777 return $value;
778 }
779 $envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders;
780 $completed = \false;
781 foreach ($envPlaceholders as $env => $placeholders) {
782 foreach ($placeholders as $placeholder) {
783 if (\false !== \stripos($value, $placeholder)) {
784 if (\true === $format) {
785 $resolved = $bag->escapeValue($this->getEnv($env));
786 } else {
787 $resolved = \sprintf($format, $env);
788 }
789 if ($placeholder === $value) {
790 $value = $resolved;
791 $completed = \true;
792 } else {
793 if (!\is_string($resolved) && !\is_numeric($resolved)) {
794 throw new RuntimeException(\sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type "%s" inside string value "%s".', $env, \get_debug_type($resolved), $this->resolveEnvPlaceholders($value)));
795 }
796 $value = \str_ireplace($placeholder, $resolved, $value);
797 }
798 $usedEnvs[$env] = $env;
799 $this->envCounters[$env] = isset($this->envCounters[$env]) ? 1 + $this->envCounters[$env] : 1;
800 if ($completed) {
801 break 2;
802 }
803 }
804 }
805 }
806 return $value;
807 }
808 public function getEnvCounters()
809 {
810 $bag = $this->getParameterBag();
811 $envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders;
812 foreach ($envPlaceholders as $env => $placeholders) {
813 if (!isset($this->envCounters[$env])) {
814 $this->envCounters[$env] = 0;
815 }
816 }
817 return $this->envCounters;
818 }
819 public function log(CompilerPassInterface $pass, string $message)
820 {
821 $this->getCompiler()->log($pass, $this->resolveEnvPlaceholders($message));
822 }
823 public static final function willBeAvailable(string $package, string $class, array $parentPackages) : bool
824 {
825 $skipDeprecation = 3 < \func_num_args() && \func_get_arg(3);
826 $hasRuntimeApi = \class_exists(InstalledVersions::class);
827 if (!$hasRuntimeApi && !$skipDeprecation) {
828 trigger_deprecation('symfony/dependency-injection', '5.4', 'Calling "%s" when dependencies have been installed with Composer 1 is deprecated. Consider upgrading to Composer 2.', __METHOD__);
829 }
830 if (!\class_exists($class) && !\interface_exists($class, \false) && !\trait_exists($class, \false)) {
831 return \false;
832 }
833 if (!$hasRuntimeApi || !InstalledVersions::isInstalled($package) || InstalledVersions::isInstalled($package, \false)) {
834 return \true;
835 }
836 // the package is installed but in dev-mode only, check if this applies to one of the parent packages too
837 $rootPackage = InstalledVersions::getRootPackage()['name'] ?? '';
838 if ('symfony/symfony' === $rootPackage) {
839 return \true;
840 }
841 foreach ($parentPackages as $parentPackage) {
842 if ($rootPackage === $parentPackage || InstalledVersions::isInstalled($parentPackage) && !InstalledVersions::isInstalled($parentPackage, \false)) {
843 return \true;
844 }
845 }
846 return \false;
847 }
848 public function getRemovedBindingIds() : array
849 {
850 return $this->removedBindingIds;
851 }
852 public function removeBindings(string $id)
853 {
854 if ($this->hasDefinition($id)) {
855 foreach ($this->getDefinition($id)->getBindings() as $key => $binding) {
856 [, $bindingId] = $binding->getValues();
857 $this->removedBindingIds[(int) $bindingId] = \true;
858 }
859 }
860 }
861 public static function getServiceConditionals($value) : array
862 {
863 $services = [];
864 if (\is_array($value)) {
865 foreach ($value as $v) {
866 $services = \array_unique(\array_merge($services, self::getServiceConditionals($v)));
867 }
868 } elseif ($value instanceof Reference && ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) {
869 $services[] = (string) $value;
870 }
871 return $services;
872 }
873 public static function getInitializedConditionals($value) : array
874 {
875 $services = [];
876 if (\is_array($value)) {
877 foreach ($value as $v) {
878 $services = \array_unique(\array_merge($services, self::getInitializedConditionals($v)));
879 }
880 } elseif ($value instanceof Reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior()) {
881 $services[] = (string) $value;
882 }
883 return $services;
884 }
885 public static function hash($value)
886 {
887 $hash = \substr(\base64_encode(\hash('sha256', \serialize($value), \true)), 0, 7);
888 return \str_replace(['/', '+'], ['.', '_'], $hash);
889 }
890 protected function getEnv(string $name)
891 {
892 $value = parent::getEnv($name);
893 $bag = $this->getParameterBag();
894 if (!\is_string($value) || !$bag instanceof EnvPlaceholderParameterBag) {
895 return $value;
896 }
897 $envPlaceholders = $bag->getEnvPlaceholders();
898 if (isset($envPlaceholders[$name][$value])) {
899 $bag = new ParameterBag($bag->all());
900 return $bag->unescapeValue($bag->get("env({$name})"));
901 }
902 foreach ($envPlaceholders as $env => $placeholders) {
903 if (isset($placeholders[$value])) {
904 return $this->getEnv($env);
905 }
906 }
907 $this->resolving["env({$name})"] = \true;
908 try {
909 return $bag->unescapeValue($this->resolveEnvPlaceholders($bag->escapeValue($value), \true));
910 } finally {
911 unset($this->resolving["env({$name})"]);
912 }
913 }
914 private function callMethod(object $service, array $call, array &$inlineServices)
915 {
916 foreach (self::getServiceConditionals($call[1]) as $s) {
917 if (!$this->has($s)) {
918 return $service;
919 }
920 }
921 foreach (self::getInitializedConditionals($call[1]) as $s) {
922 if (!$this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE, $inlineServices)) {
923 return $service;
924 }
925 }
926 $result = $service->{$call[0]}(...$this->doResolveServices($this->getParameterBag()->unescapeValue($this->getParameterBag()->resolveValue($call[1])), $inlineServices));
927 return empty($call[2]) ? $service : $result;
928 }
929 private function shareService(Definition $definition, $service, ?string $id, array &$inlineServices)
930 {
931 $inlineServices[$id ?? \spl_object_hash($definition)] = $service;
932 if (null !== $id && $definition->isShared()) {
933 if ($definition->isPrivate() && $this->isCompiled()) {
934 $this->privates[$id] = $service;
935 } else {
936 $this->services[$id] = $service;
937 }
938 unset($this->loading[$id]);
939 }
940 }
941 private function getExpressionLanguage() : ExpressionLanguage
942 {
943 if (null === $this->expressionLanguage) {
944 if (!\class_exists(\MailPoetVendor\Symfony\Component\ExpressionLanguage\ExpressionLanguage::class)) {
945 throw new LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
946 }
947 $this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders);
948 }
949 return $this->expressionLanguage;
950 }
951 private function inVendors(string $path) : bool
952 {
953 if (null === $this->vendors) {
954 $this->vendors = (new ComposerResource())->getVendors();
955 }
956 $path = \realpath($path) ?: $path;
957 foreach ($this->vendors as $vendor) {
958 if (\str_starts_with($path, $vendor) && \false !== \strpbrk(\substr($path, \strlen($vendor), 1), '/' . \DIRECTORY_SEPARATOR)) {
959 $this->addResource(new FileResource($vendor . '/composer/installed.json'));
960 return \true;
961 }
962 }
963 return \false;
964 }
965 }
966