[ Index ]

PHP Cross Reference of phpBB-3.3.11-deutsch

title

Body

[close]

/vendor/twig/twig/src/RuntimeLoader/ -> FactoryRuntimeLoader.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of Twig.
   5   *
   6   * (c) Fabien Potencier
   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 Twig\RuntimeLoader;
  13  
  14  /**
  15   * Lazy loads the runtime implementations for a Twig element.
  16   *
  17   * @author Robin Chalas <robin.chalas@gmail.com>
  18   */
  19  class FactoryRuntimeLoader implements RuntimeLoaderInterface
  20  {
  21      private $map;
  22  
  23      /**
  24       * @param array $map An array where keys are class names and values factory callables
  25       */
  26      public function __construct(array $map = [])
  27      {
  28          $this->map = $map;
  29      }
  30  
  31      public function load($class)
  32      {
  33          if (isset($this->map[$class])) {
  34              $runtimeFactory = $this->map[$class];
  35  
  36              return $runtimeFactory();
  37          }
  38      }
  39  }
  40  
  41  class_alias('Twig\RuntimeLoader\FactoryRuntimeLoader', 'Twig_FactoryRuntimeLoader');


Generated: Sat Nov 4 14:26:03 2023 Cross-referenced by PHPXref 0.7.1