First working version with non working routes

This commit is contained in:
Tim
2023-07-28 16:14:55 +02:00
commit 503d8c524a
12 changed files with 288 additions and 0 deletions

28
src/Kernel/BaseKernel.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace Ardent\Undercurrent\Kernel;
use App\Controller\BaseController;
use Ardent\Undercurrent\Container\GenericContainer;
use Ardent\Undercurrent\Controller\GenericRouter;
class BaseKernel
{
public function __invoke()
{
$container = new GenericContainer();
$container->add(GenericRouter::class);
$container->add(BaseController::class);
$this->render($container);
}
private function render(GenericContainer $container): void
{
$router = $container->get(GenericRouter::class);
$route = $router->getRoute($_SERVER['REQUEST_URI']);
$controller = $container->get($route['controller']);
$method = $route['method'];
echo $controller->$method();
}
}