}
$router = new App\Router();
- $this->collectRoutes($router->routeCollector);
+ $this->collectRoutes($router->getRouteCollector());
$this->module_class = $router->getModuleClass($this->cmd);
}
/**
- * @brief Static declaration of Friendica routes.
+ * Static declaration of Friendica routes.
*
* Supports:
* - Route groups
*
* Handler must be the name of a class extending Friendica\BaseModule.
*
+ * @brief Static declaration of Friendica routes.
* @param RouteCollector $routeCollector
* @throws InternalServerErrorException
*/
use FastRoute\Dispatcher;\r
use FastRoute\RouteCollector;\r
use FastRoute\RouteParser\Std;\r
-use Friendica\Module\Itemsource;\r
\r
+/**\r
+ * Wrapper for FastRoute\Router\r
+ *\r
+ * This wrapper only makes use of a subset of the router features, mainly parses a route rule to return the relevant\r
+ * module class.\r
+ *\r
+ * Actual routes are defined in App->collectRoutes.\r
+ *\r
+ * @package Friendica\App\r
+ */\r
class Router\r
{\r
/** @var RouteCollector */\r
- public $routeCollector;\r
+ protected $routeCollector;\r
\r
public function __construct(RouteCollector $routeCollector = null)\r
{\r
$this->routeCollector = $routeCollector;\r
}\r
\r
+ public function getRouteCollector()\r
+ {\r
+ return $this->routeCollector;\r
+ }\r
+\r
public function getModuleClass($cmd)\r
{\r
$cmd = '/' . ltrim($cmd, '/');\r
\r
return $moduleClass;\r
}\r
-}
\ No newline at end of file
+}\r