Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/dependency-injection/Compiler/ResolveEnvPlaceholdersPass.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
1 <?php | |
2 | |
3 /* | |
4 * This file is part of the Symfony package. | |
5 * | |
6 * (c) Fabien Potencier <fabien@symfony.com> | |
7 * | |
8 * For the full copyright and license information, please view the LICENSE | |
9 * file that was distributed with this source code. | |
10 */ | |
11 | |
12 namespace Symfony\Component\DependencyInjection\Compiler; | |
13 | |
14 use Symfony\Component\DependencyInjection\Definition; | |
15 | |
16 /** | |
17 * Replaces env var placeholders by their current values. | |
18 */ | |
19 class ResolveEnvPlaceholdersPass extends AbstractRecursivePass | |
20 { | |
21 protected function processValue($value, $isRoot = false) | |
22 { | |
23 if (is_string($value)) { | |
24 return $this->container->resolveEnvPlaceholders($value, true); | |
25 } | |
26 if ($value instanceof Definition) { | |
27 $changes = $value->getChanges(); | |
28 if (isset($changes['class'])) { | |
29 $value->setClass($this->container->resolveEnvPlaceholders($value->getClass(), true)); | |
30 } | |
31 if (isset($changes['file'])) { | |
32 $value->setFile($this->container->resolveEnvPlaceholders($value->getFile(), true)); | |
33 } | |
34 } | |
35 | |
36 $value = parent::processValue($value, $isRoot); | |
37 | |
38 if ($value && is_array($value) && !$isRoot) { | |
39 $value = array_combine($this->container->resolveEnvPlaceholders(array_keys($value), true), $value); | |
40 } | |
41 | |
42 return $value; | |
43 } | |
44 } |