Play around with the rendering
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\View\RouteView;
|
||||
use Ardent\Undercurrent\Attribute\Route;
|
||||
use Ardent\Undercurrent\Http\GenericResponse;
|
||||
use Ardent\Undercurrent\Http\ResponseInterface;
|
||||
@ -36,15 +37,10 @@ class HelloWorldController
|
||||
return new BaseView('/home', ['name' => $name]);
|
||||
}
|
||||
|
||||
#[Route('/routes/{word}')]
|
||||
public function routes(RouterConfig $config, string $word): ResponseInterface
|
||||
#[Route('/routes')]
|
||||
public function routes(RouterConfig $config): ViewInterface
|
||||
{
|
||||
$routes = implode('<br>', array_map(
|
||||
fn($route) => sprintf('%s - %s->%s', $route->getRoute()->path, $route->getController(), $route->getMethod()),
|
||||
$config->getRoutes()
|
||||
)) . "<br>$word";
|
||||
|
||||
return new GenericResponse($routes);
|
||||
return new RouteView($config);
|
||||
}
|
||||
|
||||
#[Route('/world/{name}')]
|
||||
|
Reference in New Issue
Block a user