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

ChainLoader.php

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


001  <?php
002   
003  /*
004   * This file is part of Twig.
005   *
006   * (c) Fabien Potencier
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 Twig\Loader;
013   
014  use Twig\Error\LoaderError;
015   
016  /**
017   * Loads templates from other loaders.
018   *
019   * @author Fabien Potencier <fabien@symfony.com>
020   */
021  final class ChainLoader implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface
022  {
023      private $hasSourceCache = [];
024      private $loaders = [];
025   
026      /**
027       * @param LoaderInterface[] $loaders
028       */
029      public function __construct(array $loaders = [])
030      {
031          foreach ($loaders as $loader) {
032              $this->addLoader($loader);
033          }
034      }
035   
036      public function addLoader(LoaderInterface $loader)
037      {
038          $this->loaders[] = $loader;
039          $this->hasSourceCache = [];
040      }
041   
042      /**
043       * @return LoaderInterface[]
044       */
045      public function getLoaders()
046      {
047          return $this->loaders;
048      }
049   
050      public function getSourceContext($name)
051      {
052          $exceptions = [];
053          foreach ($this->loaders as $loader) {
054              if (!$loader->exists($name)) {
055                  continue;
056              }
057   
058              try {
059                  return $loader->getSourceContext($name);
060              } catch (LoaderError $e) {
061                  $exceptions[] = $e->getMessage();
062              }
063          }
064   
065          throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
066      }
067   
068      public function exists($name)
069      {
070          if (isset($this->hasSourceCache[$name])) {
071              return $this->hasSourceCache[$name];
072          }
073   
074          foreach ($this->loaders as $loader) {
075              if ($loader->exists($name)) {
076                  return $this->hasSourceCache[$name] = true;
077              }
078          }
079   
080          return $this->hasSourceCache[$name] = false;
081      }
082   
083      public function getCacheKey($name)
084      {
085          $exceptions = [];
086          foreach ($this->loaders as $loader) {
087              if (!$loader->exists($name)) {
088                  continue;
089              }
090   
091              try {
092                  return $loader->getCacheKey($name);
093              } catch (LoaderError $e) {
094                  $exceptions[] = \get_class($loader).': '.$e->getMessage();
095              }
096          }
097   
098          throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
099      }
100   
101      public function isFresh($name, $time)
102      {
103          $exceptions = [];
104          foreach ($this->loaders as $loader) {
105              if (!$loader->exists($name)) {
106                  continue;
107              }
108   
109              try {
110                  return $loader->isFresh($name, $time);
111              } catch (LoaderError $e) {
112                  $exceptions[] = \get_class($loader).': '.$e->getMessage();
113              }
114          }
115   
116          throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
117      }
118  }
119   
120  class_alias('Twig\Loader\ChainLoader', 'Twig_Loader_Chain');
121