mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-12 01:12:14 +00:00
Merge pull request #604 from xJuvi/xJuvi-patch-1
Make current processing rule accessible
This commit is contained in:
@@ -35,6 +35,12 @@ class Router
|
|||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $isProcessingRoute;
|
protected $isProcessingRoute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines all data from current processing route.
|
||||||
|
* @var ILoadableRoute
|
||||||
|
*/
|
||||||
|
protected $currentProcessingRoute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All added routes
|
* All added routes
|
||||||
@@ -371,6 +377,9 @@ class Router
|
|||||||
foreach ($this->processedRoutes as $key => $route) {
|
foreach ($this->processedRoutes as $key => $route) {
|
||||||
|
|
||||||
$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) {
|
||||||
@@ -927,6 +936,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.
|
||||||
@@ -950,4 +969,4 @@ class Router
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user