diff options
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/functions_url_matcher.php | 4 | ||||
-rw-r--r-- | phpBB/phpbb/controller/helper.php | 3 | ||||
-rw-r--r-- | phpBB/phpbb/controller/provider.php | 26 |
3 files changed, 24 insertions, 9 deletions
diff --git a/phpBB/includes/functions_url_matcher.php b/phpBB/includes/functions_url_matcher.php index 4db1bfa01f..8e5ae20f93 100644 --- a/phpBB/includes/functions_url_matcher.php +++ b/phpBB/includes/functions_url_matcher.php @@ -54,7 +54,7 @@ function phpbb_get_url_matcher(\phpbb\extension\finder $finder, RequestContext $ function phpbb_create_dumped_url_matcher(\phpbb\extension\finder $finder, $root_path, $php_ext) { $provider = new \phpbb\controller\provider($finder); - $routes = $provider->find($root_path); + $routes = $provider->find($root_path)->get_routes(); $dumper = new PhpMatcherDumper($routes); $cached_url_matcher_dump = $dumper->dump(array( 'class' => 'phpbb_url_matcher', @@ -73,7 +73,7 @@ function phpbb_create_dumped_url_matcher(\phpbb\extension\finder $finder, $root_ function phpbb_create_url_matcher(\phpbb\extension\finder $finder, RequestContext $context, $root_path) { $provider = new \phpbb\controller\provider($finder); - $routes = $provider->find($root_path); + $routes = $provider->find($root_path)->get_routes(); return new UrlMatcher($routes, $context); } diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 8e33aaf605..2d11a54c08 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -66,8 +66,7 @@ class helper $this->config = $config; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; - $this->route_collection = $provider->find($this->phpbb_root_path); - + $this->route_collection = $provider->find($this->phpbb_root_path)->get_routes(); } /** diff --git a/phpBB/phpbb/controller/provider.php b/phpBB/phpbb/controller/provider.php index fbe717f1af..9df8130210 100644 --- a/phpBB/phpbb/controller/provider.php +++ b/phpBB/phpbb/controller/provider.php @@ -26,6 +26,12 @@ class provider protected $routing_files; /** + * Collection of the routes in phpBB and all found extensions + * @var RouteCollection + */ + protected $routes; + + /** * Construct method * * @param array() $routing_files Array of strings containing paths @@ -48,20 +54,30 @@ class provider } /** - * Get a list of controllers and return it + * Find a list of controllers and return it * * @param string $base_path Base path to prepend to file paths - * @return array Array of controllers and their route information + * @return null */ public function find($base_path = '') { - $routes = new RouteCollection; + $this->routes = new RouteCollection; foreach ($this->routing_files as $file_path) { $loader = new YamlFileLoader(new FileLocator($base_path)); - $routes->addCollection($loader->load($file_path)); + $this->routes->addCollection($loader->load($file_path)); } - return $routes; + return $this; + } + + /** + * Get the list of routes + * + * @return RouteCollection Get the route collection + */ + public function get_routes() + { + return $this->routes; } } |