[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ -> ResolveParameterPlaceHoldersPass.php (source)

   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       * @param ContainerBuilder $container
  28       *
  29       * @throws ParameterNotFoundException
  30       */
  31      public function process(ContainerBuilder $container)
  32      {
  33          $parameterBag = $container->getParameterBag();
  34  
  35          foreach ($container->getDefinitions() as $id => $definition) {
  36              try {
  37                  $definition->setClass($parameterBag->resolveValue($definition->getClass()));
  38                  $definition->setFile($parameterBag->resolveValue($definition->getFile()));
  39                  $definition->setArguments($parameterBag->resolveValue($definition->getArguments()));
  40                  $definition->setFactoryClass($parameterBag->resolveValue($definition->getFactoryClass()));
  41  
  42                  $calls = array();
  43                  foreach ($definition->getMethodCalls() as $name => $arguments) {
  44                      $calls[$parameterBag->resolveValue($name)] = $parameterBag->resolveValue($arguments);
  45                  }
  46                  $definition->setMethodCalls($calls);
  47  
  48                  $definition->setProperties($parameterBag->resolveValue($definition->getProperties()));
  49              } catch (ParameterNotFoundException $e) {
  50                  $e->setSourceId($id);
  51  
  52                  throw $e;
  53              }
  54          }
  55  
  56          $aliases = array();
  57          foreach ($container->getAliases() as $name => $target) {
  58              $aliases[$parameterBag->resolveValue($name)] = $parameterBag->resolveValue($target);
  59          }
  60          $container->setAliases($aliases);
  61  
  62          $parameterBag->resolve();
  63      }
  64  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1