mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-11 03:04:09 +02:00
[ticket/12090] Split finding routes and returning routes into 2 methods
PHPBB3-12090
This commit is contained in:
@@ -25,6 +25,12 @@ class provider
|
||||
*/
|
||||
protected $routing_files;
|
||||
|
||||
/**
|
||||
* Collection of the routes in phpBB and all found extensions
|
||||
* @var RouteCollection
|
||||
*/
|
||||
protected $routes;
|
||||
|
||||
/**
|
||||
* Construct method
|
||||
*
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user