4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\DependencyInjection\Compiler;
14 use Symfony\Component\DependencyInjection\Definition;
17 * Replaces env var placeholders by their current values.
19 class ResolveEnvPlaceholdersPass extends AbstractRecursivePass
21 protected function processValue($value, $isRoot = false)
23 if (\is_string($value)) {
24 return $this->container->resolveEnvPlaceholders($value, true);
26 if ($value instanceof Definition) {
27 $changes = $value->getChanges();
28 if (isset($changes['class'])) {
29 $value->setClass($this->container->resolveEnvPlaceholders($value->getClass(), true));
31 if (isset($changes['file'])) {
32 $value->setFile($this->container->resolveEnvPlaceholders($value->getFile(), true));
36 $value = parent::processValue($value, $isRoot);
38 if ($value && \is_array($value) && !$isRoot) {
39 $value = array_combine($this->container->resolveEnvPlaceholders(array_keys($value), true), $value);