Overview

Namespaces

  • Contrib
    • Bundle
      • CoverallsBundle
        • Console
        • Entity
      • CoverallsV1Bundle
        • Api
        • Collector
        • Command
        • Config
        • Entity
          • Git
    • Component
      • File
      • Log
      • System
        • Git
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Config
        • Definition
          • Builder
          • Exception
        • Exception
        • Loader
        • Resource
        • Util
      • Console
        • Command
        • Formatter
        • Helper
        • Input
        • Output
        • Tester
      • EventDispatcher
        • Debug
      • Finder
        • Adapter
        • Comparator
        • Exception
        • Expression
        • Iterator
        • Shell
      • Stopwatch
      • Yaml
        • Exception

Classes

  • DelegatingLoader
  • FileLoader
  • Loader
  • LoaderResolver

Interfaces

  • LoaderInterface
  • LoaderResolverInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 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:  * DelegatingLoader delegates loading to other loaders using a loader resolver.
18:  *
19:  * This loader acts as an array of LoaderInterface objects - each having
20:  * a chance to load a given resource (handled by the resolver)
21:  *
22:  * @author Fabien Potencier <fabien@symfony.com>
23:  */
24: class DelegatingLoader extends Loader
25: {
26:     /**
27:      * Constructor.
28:      *
29:      * @param LoaderResolverInterface $resolver A LoaderResolverInterface instance
30:      */
31:     public function __construct(LoaderResolverInterface $resolver)
32:     {
33:         $this->resolver = $resolver;
34:     }
35: 
36:     /**
37:      * Loads a resource.
38:      *
39:      * @param mixed  $resource A resource
40:      * @param string $type     The resource type
41:      *
42:      * @return mixed
43:      *
44:      * @throws FileLoaderLoadException if no loader is found.
45:      */
46:     public function load($resource, $type = null)
47:     {
48:         if (false === $loader = $this->resolver->resolve($resource, $type)) {
49:             throw new FileLoaderLoadException($resource);
50:         }
51: 
52:         return $loader->load($resource, $type);
53:     }
54: 
55:     /**
56:      * {@inheritdoc}
57:      */
58:     public function supports($resource, $type = null)
59:     {
60:         return false === $this->resolver->resolve($resource, $type) ? false : true;
61:     }
62: }
63: 
php-coveralls API documentation generated by ApiGen 2.8.0