Merge pull request #604 from xJuvi/xJuvi-patch-1

Make current processing rule accessible
This commit is contained in:
Simon Sessingø
2023-02-09 02:28:34 +01:00
committed by GitHub
+19
View File
@@ -36,6 +36,12 @@ class Router
*/ */
protected $isProcessingRoute; protected $isProcessingRoute;
/**
* Defines all data from current processing route.
* @var ILoadableRoute
*/
protected $currentProcessingRoute;
/** /**
* All added routes * All added routes
* @var array * @var array
@@ -372,6 +378,9 @@ class Router
$this->debug('Matching route "%s"', get_class($route)); $this->debug('Matching route "%s"', get_class($route));
/* Add current processing route to constants */
$this->currentProcessingRoute = $route;
/* If the route matches */ /* If the route matches */
if ($route->matchRoute($url, $this->request) === true) { if ($route->matchRoute($url, $this->request) === true) {
@@ -928,6 +937,16 @@ class Router
return $this->debugList; return $this->debugList;
} }
/**
* Get the current processing route details.
*
* @return ILoadableRoute
*/
public function getCurrentProcessingRoute(): ILoadableRoute
{
return $this->currentProcessingRoute;
}
/** /**
* Changes the rendering behavior of the router. * Changes the rendering behavior of the router.
* When enabled the router will render all routes that matches. * When enabled the router will render all routes that matches.