- Work done to clarify a bit every section, and a hugh code refractoring also was made to the code base.

This commit is contained in:
Dave Mc Nicoll committed 2024-11-11 19:54:22 +00:00
1 parent a98e46c343
commit 6b655bdc76
15 files changed
+260 -145

No files matched your search

+11 -7
View File
@@ -22,12 +22,9 @@ HTML;
protected UrlExtension $urlExtension,
) {}
/**
* @return Returns HTML describing given controller's routes
*/
public function describe() : string
public function getRoutes() : array
{
$html = "";
$routes = [];
$reflector = new ObjectReflection($this->controller::class);
@@ -42,11 +39,18 @@ HTML;
$cleaned = $this->cleanRouteFromRegex($base.$path);
$url = $this->urlExtension->buildUrl($cleaned);
$html .= sprintf($this->routeLine, $url, $base.$path, $cleaned, $route->description, implode(', ', (array)$route->method), $route->name );
$routes[] = [
'name' => $route->name,
'route' => $url,
'path' => $base.$path,
'cleaned' => $cleaned,
'description'=> $route->description,
'methods' =>implode(', ', (array)$route->method),
];
}
}
return sprintf('<ul>%s</ul>', $html);
return $routes;
}
protected function cleanRouteFromRegex(string $route) : string