diff --git a/app/Controller/HelloWorldController.php b/app/Controller/HelloWorldController.php
index eed77a5..340740d 100644
--- a/app/Controller/HelloWorldController.php
+++ b/app/Controller/HelloWorldController.php
@@ -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('
', array_map(
- fn($route) => sprintf('%s - %s->%s', $route->getRoute()->path, $route->getController(), $route->getMethod()),
- $config->getRoutes()
- )) . "
$word";
-
- return new GenericResponse($routes);
+ return new RouteView($config);
}
#[Route('/world/{name}')]
diff --git a/app/Template/base.php b/app/Template/base.php
index f4cee5c..ef4b5e6 100644
--- a/app/Template/base.php
+++ b/app/Template/base.php
@@ -1,10 +1,12 @@
-
'; + echo 'Log:
'; foreach ($log->getLogs() as $log) { echo sprintf('%s
', $log); } diff --git a/src/View/BaseView.php b/src/View/BaseView.php index 5050e86..3263226 100644 --- a/src/View/BaseView.php +++ b/src/View/BaseView.php @@ -11,7 +11,7 @@ class BaseView implements ViewInterface public function __construct( private readonly string $path, private readonly array $data = [], - private ?string $extends = null, + protected ?string $extends = null, ) { } @@ -38,7 +38,7 @@ class BaseView implements ViewInterface return $output; } - public function getRoute(string $class, string $method, array $params = []): string + protected function getRoute(string $class, string $method, array $params = []): string { return $this->helper->getRouter()->toUri($class, $method, $params); }