vendor/symfony/config/Loader/DelegatingLoader.php line 37

  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Config\Loader;
  11. use Symfony\Component\Config\Exception\LoaderLoadException;
  12. /**
  13.  * DelegatingLoader delegates loading to other loaders using a loader resolver.
  14.  *
  15.  * This loader acts as an array of LoaderInterface objects - each having
  16.  * a chance to load a given resource (handled by the resolver)
  17.  *
  18.  * @author Fabien Potencier <fabien@symfony.com>
  19.  */
  20. class DelegatingLoader extends Loader
  21. {
  22.     public function __construct(LoaderResolverInterface $resolver)
  23.     {
  24.         $this->resolver $resolver;
  25.     }
  26.     public function load(mixed $resourcestring $type null): mixed
  27.     {
  28.         if (false === $loader $this->resolver->resolve($resource$type)) {
  29.             throw new LoaderLoadException($resourcenull0null$type);
  30.         }
  31.         return $loader->load($resource$type);
  32.     }
  33.     public function supports(mixed $resourcestring $type null): bool
  34.     {
  35.         return false !== $this->resolver->resolve($resource$type);
  36.     }
  37. }