[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/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;
  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          $this->log = array();
  34      }
  35  
  36      /**
  37       * Returns the PassConfig.
  38       *
  39       * @return PassConfig The PassConfig instance
  40       */
  41      public function getPassConfig()
  42      {
  43          return $this->passConfig;
  44      }
  45  
  46      /**
  47       * Returns the ServiceReferenceGraph.
  48       *
  49       * @return ServiceReferenceGraph The ServiceReferenceGraph instance
  50       */
  51      public function getServiceReferenceGraph()
  52      {
  53          return $this->serviceReferenceGraph;
  54      }
  55  
  56      /**
  57       * Returns the logging formatter which can be used by compilation passes.
  58       *
  59       * @return LoggingFormatter
  60       */
  61      public function getLoggingFormatter()
  62      {
  63          return $this->loggingFormatter;
  64      }
  65  
  66      /**
  67       * Adds a pass to the PassConfig.
  68       *
  69       * @param CompilerPassInterface $pass A compiler pass
  70       * @param string                $type The type of the pass
  71       */
  72      public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION)
  73      {
  74          $this->passConfig->addPass($pass, $type);
  75      }
  76  
  77      /**
  78       * Adds a log message.
  79       *
  80       * @param string $string The log message
  81       */
  82      public function addLogMessage($string)
  83      {
  84          $this->log[] = $string;
  85      }
  86  
  87      /**
  88       * Returns the log.
  89       *
  90       * @return array Log array
  91       */
  92      public function getLog()
  93      {
  94          return $this->log;
  95      }
  96  
  97      /**
  98       * Run the Compiler and process all Passes.
  99       *
 100       * @param ContainerBuilder $container
 101       */
 102      public function compile(ContainerBuilder $container)
 103      {
 104          foreach ($this->passConfig->getPasses() as $pass) {
 105              $pass->process($container);
 106          }
 107      }
 108  }


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