Verzeichnisstruktur phpBB-3.1.0
- Veröffentlicht
- 27.10.2014
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
LoaderResolver.php
01 <?php
02
03 /*
04 * This file is part of the Symfony package.
05 *
06 * (c) Fabien Potencier <fabien@symfony.com>
07 *
08 * For the full copyright and license information, please view the LICENSE
09 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Config\Loader;
13
14 /**
15 * LoaderResolver selects a loader for a given resource.
16 *
17 * A resource can be anything (e.g. a full path to a config file or a Closure).
18 * Each loader determines whether it can load a resource and how.
19 *
20 * @author Fabien Potencier <fabien@symfony.com>
21 */
22 class LoaderResolver implements LoaderResolverInterface
23 {
24 /**
25 * @var LoaderInterface[] An array of LoaderInterface objects
26 */
27 private $loaders;
28
29 /**
30 * Constructor.
31 *
32 * @param LoaderInterface[] $loaders An array of loaders
33 */
34 public function __construct(array $loaders = array())
35 {
36 $this->loaders = array();
37 foreach ($loaders as $loader) {
38 $this->addLoader($loader);
39 }
40 }
41
42 /**
43 * Returns a loader able to load the resource.
44 *
45 * @param mixed $resource A resource
46 * @param string $type The resource type
47 *
48 * @return LoaderInterface|false A LoaderInterface instance
49 */
50 public function resolve($resource, $type = null)
51 {
52 foreach ($this->loaders as $loader) {
53 if ($loader->supports($resource, $type)) {
54 return $loader;
55 }
56 }
57
58 return false;
59 }
60
61 /**
62 * Adds a loader.
63 *
64 * @param LoaderInterface $loader A LoaderInterface instance
65 */
66 public function addLoader(LoaderInterface $loader)
67 {
68 $this->loaders[] = $loader;
69 $loader->setResolver($this);
70 }
71
72 /**
73 * Returns the registered loaders.
74 *
75 * @return LoaderInterface[] An array of LoaderInterface instances
76 */
77 public function getLoaders()
78 {
79 return $this->loaders;
80 }
81 }
82