[ Index ]

PHP Cross Reference of phpBB-3.3.7-deutsch

title

Body

[close]

/vendor/symfony/dependency-injection/Compiler/ -> ResolveFactoryClassPass.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\Definition;
  15  use Symfony\Component\DependencyInjection\Exception\RuntimeException;
  16  
  17  /**
  18   * @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
  19   */
  20  class ResolveFactoryClassPass extends AbstractRecursivePass
  21  {
  22      /**
  23       * {@inheritdoc}
  24       */
  25      protected function processValue($value, $isRoot = false)
  26      {
  27          if ($value instanceof Definition && \is_array($factory = $value->getFactory()) && null === $factory[0]) {
  28              if (null === $class = $value->getClass()) {
  29                  throw new RuntimeException(sprintf('The "%s" service is defined to be created by a factory, but is missing the factory class. Did you forget to define the factory or service class?', $this->currentId));
  30              }
  31  
  32              $factory[0] = $class;
  33              $value->setFactory($factory);
  34          }
  35  
  36          return parent::processValue($value, $isRoot);
  37      }
  38  }


Generated: Thu Mar 24 21:31:15 2022 Cross-referenced by PHPXref 0.7.1