Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
feat: update getRoute to display all route info
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Apr 25, 2023
1 parent 77aee5d commit 3def5e8
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/Router/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,23 @@ public static function getCurrentUri(): string
*/
public static function getRoute(): array
{
return [
'path' => static::getCurrentUri(),
$routeConfig = [];

foreach (static::$appRoutes as $route) {
if ($route['pattern'] === static::getCurrentUri()) {
$route['path'] = $route['pattern'];

unset($route['pattern']);
unset($route['methods']);

$routeConfig = $route;
break;
}
}

return array_merge($routeConfig, [
'method' => \Leaf\Http\Request::getMethod(),
];
]);
}

/**
Expand Down

0 comments on commit 3def5e8

Please sign in to comment.