- 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:
1 parent
a98e46c343
commit
6b655bdc76
15 files changed
+260
-145
No files matched your search
+11
-7
@@ -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
|
||||
|
||||
Reference in new issue
Block a user