class ResolveParameterPlaceHoldersPass in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php \Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass
Resolves all parameter placeholders "%somevalue%" to their real values.
@author Johannes M. Schmitt <schmittjoh@gmail.com>
Hierarchy
- class \Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass implements CompilerPassInterface
Expanded class hierarchy of ResolveParameterPlaceHoldersPass
2 files declare their use of ResolveParameterPlaceHoldersPass
- LegacyResolveParameterPlaceHoldersPassTest.php in vendor/
symfony/ dependency-injection/ Tests/ Compiler/ LegacyResolveParameterPlaceHoldersPassTest.php - ResolveParameterPlaceHoldersPassTest.php in vendor/
symfony/ dependency-injection/ Tests/ Compiler/ ResolveParameterPlaceHoldersPassTest.php
File
- vendor/
symfony/ dependency-injection/ Compiler/ ResolveParameterPlaceHoldersPass.php, line 22
Namespace
Symfony\Component\DependencyInjection\CompilerView source
class ResolveParameterPlaceHoldersPass implements CompilerPassInterface {
/**
* Processes the ContainerBuilder to resolve parameter placeholders.
*
* @param ContainerBuilder $container
*
* @throws ParameterNotFoundException
*/
public function process(ContainerBuilder $container) {
$parameterBag = $container
->getParameterBag();
foreach ($container
->getDefinitions() as $id => $definition) {
try {
$definition
->setClass($parameterBag
->resolveValue($definition
->getClass()));
$definition
->setFile($parameterBag
->resolveValue($definition
->getFile()));
$definition
->setArguments($parameterBag
->resolveValue($definition
->getArguments()));
if ($definition
->getFactoryClass(false)) {
$definition
->setFactoryClass($parameterBag
->resolveValue($definition
->getFactoryClass(false)));
}
$factory = $definition
->getFactory();
if (is_array($factory) && isset($factory[0])) {
$factory[0] = $parameterBag
->resolveValue($factory[0]);
$definition
->setFactory($factory);
}
$calls = array();
foreach ($definition
->getMethodCalls() as $name => $arguments) {
$calls[$parameterBag
->resolveValue($name)] = $parameterBag
->resolveValue($arguments);
}
$definition
->setMethodCalls($calls);
$definition
->setProperties($parameterBag
->resolveValue($definition
->getProperties()));
} catch (ParameterNotFoundException $e) {
$e
->setSourceId($id);
throw $e;
}
}
$aliases = array();
foreach ($container
->getAliases() as $name => $target) {
$aliases[$parameterBag
->resolveValue($name)] = $parameterBag
->resolveValue($target);
}
$container
->setAliases($aliases);
$parameterBag
->resolve();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ResolveParameterPlaceHoldersPass:: |
public | function |
Processes the ContainerBuilder to resolve parameter placeholders. Overrides CompilerPassInterface:: |