[ Index ]

PHP Cross Reference of phpBB-3.3.2-deutsch

title

Body

[close]

/vendor/symfony/config/Loader/ -> Loader.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\Config\Loader;
  13  
  14  use Symfony\Component\Config\Exception\FileLoaderLoadException;
  15  
  16  /**
  17   * Loader is the abstract class used by all built-in loaders.
  18   *
  19   * @author Fabien Potencier <fabien@symfony.com>
  20   */
  21  abstract class Loader implements LoaderInterface
  22  {
  23      protected $resolver;
  24  
  25      /**
  26       * {@inheritdoc}
  27       */
  28      public function getResolver()
  29      {
  30          return $this->resolver;
  31      }
  32  
  33      /**
  34       * {@inheritdoc}
  35       */
  36      public function setResolver(LoaderResolverInterface $resolver)
  37      {
  38          $this->resolver = $resolver;
  39      }
  40  
  41      /**
  42       * Imports a resource.
  43       *
  44       * @param mixed       $resource A resource
  45       * @param string|null $type     The resource type or null if unknown
  46       *
  47       * @return mixed
  48       */
  49      public function import($resource, $type = null)
  50      {
  51          return $this->resolve($resource, $type)->load($resource, $type);
  52      }
  53  
  54      /**
  55       * Finds a loader able to load an imported resource.
  56       *
  57       * @param mixed       $resource A resource
  58       * @param string|null $type     The resource type or null if unknown
  59       *
  60       * @return $this|LoaderInterface
  61       *
  62       * @throws FileLoaderLoadException If no loader is found
  63       */
  64      public function resolve($resource, $type = null)
  65      {
  66          if ($this->supports($resource, $type)) {
  67              return $this;
  68          }
  69  
  70          $loader = null === $this->resolver ? false : $this->resolver->resolve($resource, $type);
  71  
  72          if (false === $loader) {
  73              throw new FileLoaderLoadException($resource, null, null, null, $type);
  74          }
  75  
  76          return $loader;
  77      }
  78  }


Generated: Wed Nov 11 20:28:18 2020 Cross-referenced by PHPXref 0.7.1