[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
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\ContainerBuilder; 15 use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; 16 17 /** 18 * Resolves all parameter placeholders "%somevalue%" to their real values. 19 * 20 * @author Johannes M. Schmitt <schmittjoh@gmail.com> 21 */ 22 class ResolveParameterPlaceHoldersPass implements CompilerPassInterface 23 { 24 /** 25 * Processes the ContainerBuilder to resolve parameter placeholders. 26 * 27 * @throws ParameterNotFoundException 28 */ 29 public function process(ContainerBuilder $container) 30 { 31 $parameterBag = $container->getParameterBag(); 32 33 foreach ($container->getDefinitions() as $id => $definition) { 34 try { 35 $definition->setClass($parameterBag->resolveValue($definition->getClass())); 36 $definition->setFile($parameterBag->resolveValue($definition->getFile())); 37 $definition->setArguments($parameterBag->resolveValue($definition->getArguments())); 38 if ($definition->getFactoryClass(false)) { 39 $definition->setFactoryClass($parameterBag->resolveValue($definition->getFactoryClass(false))); 40 } 41 42 $factory = $definition->getFactory(); 43 44 if (\is_array($factory) && isset($factory[0])) { 45 $factory[0] = $parameterBag->resolveValue($factory[0]); 46 $definition->setFactory($factory); 47 } 48 49 $calls = array(); 50 foreach ($definition->getMethodCalls() as $name => $arguments) { 51 $calls[$parameterBag->resolveValue($name)] = $parameterBag->resolveValue($arguments); 52 } 53 $definition->setMethodCalls($calls); 54 55 $definition->setProperties($parameterBag->resolveValue($definition->getProperties())); 56 } catch (ParameterNotFoundException $e) { 57 $e->setSourceId($id); 58 59 throw $e; 60 } 61 } 62 63 $aliases = array(); 64 foreach ($container->getAliases() as $name => $target) { 65 $aliases[$parameterBag->resolveValue($name)] = $target; 66 } 67 $container->setAliases($aliases); 68 69 $parameterBag->resolve(); 70 } 71 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |