aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/routing/loader_resolver.php
diff options
context:
space:
mode:
authorTristan Darricau <tristan.darricau@sensiolabs.com>2015-10-07 23:09:13 +0200
committerTristan Darricau <tristan.darricau@sensiolabs.com>2015-10-08 14:15:44 +0200
commit403c647b9e84640977ca0f98d21d15ceb4957bdb (patch)
tree43ef25beb7444ee2f49f5a814f51b0f268b7bb2e /phpBB/phpbb/routing/loader_resolver.php
parent82743c792287a1efe906c231df7d22dadc8bedcd (diff)
downloadforums-403c647b9e84640977ca0f98d21d15ceb4957bdb.tar
forums-403c647b9e84640977ca0f98d21d15ceb4957bdb.tar.gz
forums-403c647b9e84640977ca0f98d21d15ceb4957bdb.tar.bz2
forums-403c647b9e84640977ca0f98d21d15ceb4957bdb.tar.xz
forums-403c647b9e84640977ca0f98d21d15ceb4957bdb.zip
[ticket/14220] Move route loading to services
PHPBB3-14220
Diffstat (limited to 'phpBB/phpbb/routing/loader_resolver.php')
-rw-r--r--phpBB/phpbb/routing/loader_resolver.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/phpBB/phpbb/routing/loader_resolver.php b/phpBB/phpbb/routing/loader_resolver.php
new file mode 100644
index 0000000000..e335051444
--- /dev/null
+++ b/phpBB/phpbb/routing/loader_resolver.php
@@ -0,0 +1,49 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\routing;
+
+use Symfony\Component\Config\Loader\LoaderResolverInterface;
+
+/**
+ * @see Symfony\Component\Config\Loader\LoaderResolver
+ */
+class loader_resolver implements LoaderResolverInterface
+{
+ /**
+ * @var \Symfony\Component\Config\Loader\LoaderInterface[] An array of LoaderInterface objects
+ */
+ protected $loaders = [];
+
+ public function __construct($loaders = [])
+ {
+ $this->loaders = $loaders;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function resolve($resource, $type = null)
+ {
+ /** @var \Symfony\Component\Config\Loader\LoaderInterface $loader */
+ foreach ($this->loaders as $loader)
+ {
+ if ($loader->supports($resource, $type))
+ {
+ return $loader;
+ }
+ }
+
+ return false;
+ }
+}