composer package updates
[openemr.git] / vendor / symfony / config / Loader / DelegatingLoader.php
blob237009d45e6d169063f8d5b7ffcccdb5eb5b8b6b
1 <?php
3 /*
4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Config\Loader;
14 use Symfony\Component\Config\Exception\FileLoaderLoadException;
16 /**
17 * DelegatingLoader delegates loading to other loaders using a loader resolver.
19 * This loader acts as an array of LoaderInterface objects - each having
20 * a chance to load a given resource (handled by the resolver)
22 * @author Fabien Potencier <fabien@symfony.com>
24 class DelegatingLoader extends Loader
26 public function __construct(LoaderResolverInterface $resolver)
28 $this->resolver = $resolver;
31 /**
32 * {@inheritdoc}
34 public function load($resource, $type = null)
36 if (false === $loader = $this->resolver->resolve($resource, $type)) {
37 throw new FileLoaderLoadException($resource);
40 return $loader->load($resource, $type);
43 /**
44 * {@inheritdoc}
46 public function supports($resource, $type = null)
48 return false !== $this->resolver->resolve($resource, $type);