[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/symfony/dependency-injection/Compiler/ -> Compiler.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  
  16  /**
  17   * This class is used to remove circular dependencies between individual passes.
  18   *
  19   * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  20   */
  21  class Compiler
  22  {
  23      private $passConfig;
  24      private $log = array();
  25      private $loggingFormatter;
  26      private $serviceReferenceGraph;
  27  
  28      public function __construct()
  29      {
  30          $this->passConfig = new PassConfig();
  31          $this->serviceReferenceGraph = new ServiceReferenceGraph();
  32          $this->loggingFormatter = new LoggingFormatter();
  33      }
  34  
  35      /**
  36       * Returns the PassConfig.
  37       *
  38       * @return PassConfig The PassConfig instance
  39       */
  40      public function getPassConfig()
  41      {
  42          return $this->passConfig;
  43      }
  44  
  45      /**
  46       * Returns the ServiceReferenceGraph.
  47       *
  48       * @return ServiceReferenceGraph The ServiceReferenceGraph instance
  49       */
  50      public function getServiceReferenceGraph()
  51      {
  52          return $this->serviceReferenceGraph;
  53      }
  54  
  55      /**
  56       * Returns the logging formatter which can be used by compilation passes.
  57       *
  58       * @return LoggingFormatter
  59       */
  60      public function getLoggingFormatter()
  61      {
  62          return $this->loggingFormatter;
  63      }
  64  
  65      /**
  66       * Adds a pass to the PassConfig.
  67       *
  68       * @param CompilerPassInterface $pass A compiler pass
  69       * @param string                $type The type of the pass
  70       */
  71      public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION)
  72      {
  73          $this->passConfig->addPass($pass, $type);
  74      }
  75  
  76      /**
  77       * Adds a log message.
  78       *
  79       * @param string $string The log message
  80       */
  81      public function addLogMessage($string)
  82      {
  83          $this->log[] = $string;
  84      }
  85  
  86      /**
  87       * Returns the log.
  88       *
  89       * @return array Log array
  90       */
  91      public function getLog()
  92      {
  93          return $this->log;
  94      }
  95  
  96      /**
  97       * Run the Compiler and process all Passes.
  98       */
  99      public function compile(ContainerBuilder $container)
 100      {
 101          foreach ($this->passConfig->getPasses() as $pass) {
 102              $pass->process($container);
 103          }
 104      }
 105  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1