Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

Compiler.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 4.71 KiB


001  <?php
002   
003  /*
004   * This file is part of the Symfony package.
005   *
006   * (c) Fabien Potencier <fabien@symfony.com>
007   *
008   * For the full copyright and license information, please view the LICENSE
009   * file that was distributed with this source code.
010   */
011   
012  namespace Symfony\Component\DependencyInjection\Compiler;
013   
014  use Symfony\Component\DependencyInjection\ContainerBuilder;
015  use Symfony\Component\DependencyInjection\Exception\EnvParameterException;
016   
017  /**
018   * This class is used to remove circular dependencies between individual passes.
019   *
020   * @author Johannes M. Schmitt <schmittjoh@gmail.com>
021   */
022  class Compiler
023  {
024      private $passConfig;
025      private $log = [];
026      private $loggingFormatter;
027      private $serviceReferenceGraph;
028   
029      public function __construct()
030      {
031          $this->passConfig = new PassConfig();
032          $this->serviceReferenceGraph = new ServiceReferenceGraph();
033      }
034   
035      /**
036       * Returns the PassConfig.
037       *
038       * @return PassConfig The PassConfig instance
039       */
040      public function getPassConfig()
041      {
042          return $this->passConfig;
043      }
044   
045      /**
046       * Returns the ServiceReferenceGraph.
047       *
048       * @return ServiceReferenceGraph The ServiceReferenceGraph instance
049       */
050      public function getServiceReferenceGraph()
051      {
052          return $this->serviceReferenceGraph;
053      }
054   
055      /**
056       * Returns the logging formatter which can be used by compilation passes.
057       *
058       * @return LoggingFormatter
059       *
060       * @deprecated since version 3.3, to be removed in 4.0. Use the ContainerBuilder::log() method instead.
061       */
062      public function getLoggingFormatter()
063      {
064          if (null === $this->loggingFormatter) {
065              @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), \E_USER_DEPRECATED);
066   
067              $this->loggingFormatter = new LoggingFormatter();
068          }
069   
070          return $this->loggingFormatter;
071      }
072   
073      /**
074       * Adds a pass to the PassConfig.
075       *
076       * @param CompilerPassInterface $pass A compiler pass
077       * @param string                $type The type of the pass
078       */
079      public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/)
080      {
081          if (\func_num_args() >= 3) {
082              $priority = func_get_arg(2);
083          } else {
084              if (__CLASS__ !== static::class) {
085                  $r = new \ReflectionMethod($this, __FUNCTION__);
086                  if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
087                      @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), \E_USER_DEPRECATED);
088                  }
089              }
090   
091              $priority = 0;
092          }
093   
094          $this->passConfig->addPass($pass, $type, $priority);
095      }
096   
097      /**
098       * Adds a log message.
099       *
100       * @param string $string The log message
101       *
102       * @deprecated since version 3.3, to be removed in 4.0. Use the ContainerBuilder::log() method instead.
103       */
104      public function addLogMessage($string)
105      {
106          @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), \E_USER_DEPRECATED);
107   
108          $this->log[] = $string;
109      }
110   
111      /**
112       * @final
113       */
114      public function log(CompilerPassInterface $pass, $message)
115      {
116          if (false !== strpos($message, "\n")) {
117              $message = str_replace("\n", "\n".\get_class($pass).': ', trim($message));
118          }
119   
120          $this->log[] = \get_class($pass).': '.$message;
121      }
122   
123      /**
124       * Returns the log.
125       *
126       * @return array Log array
127       */
128      public function getLog()
129      {
130          return $this->log;
131      }
132   
133      /**
134       * Run the Compiler and process all Passes.
135       */
136      public function compile(ContainerBuilder $container)
137      {
138          try {
139              foreach ($this->passConfig->getPasses() as $pass) {
140                  $pass->process($container);
141              }
142          } catch (\Exception $e) {
143              $usedEnvs = [];
144              $prev = $e;
145   
146              do {
147                  $msg = $prev->getMessage();
148   
149                  if ($msg !== $resolvedMsg = $container->resolveEnvPlaceholders($msg, null, $usedEnvs)) {
150                      $r = new \ReflectionProperty($prev, 'message');
151                      $r->setAccessible(true);
152                      $r->setValue($prev, $resolvedMsg);
153                  }
154              } while ($prev = $prev->getPrevious());
155   
156              if ($usedEnvs) {
157                  $e = new EnvParameterException($usedEnvs, $e);
158              }
159   
160              throw $e;
161          } finally {
162              $this->getServiceReferenceGraph()->clear();
163          }
164      }
165  }
166