diff --git a/.forgejo/workflows/push.yml b/.forgejo/workflows/push.yml index f722de8..591622c 100644 --- a/.forgejo/workflows/push.yml +++ b/.forgejo/workflows/push.yml @@ -3,7 +3,7 @@ jobs: ls: runs-on: docker container: - image: git.php.fail/lubiana/container/php:8.2.11-node-2 + image: git.php.fail/lubiana/container/php:8.3.0-node steps: - uses: actions/checkout@v3 - name: Get Composer Cache Directory diff --git a/composer.json b/composer.json index 55f8938..81c86d1 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": ">=8.2", + "php": ">=8.3", "ext-apcu": "*", "php-di/php-di": "^7.0.1", "nikic/fast-route": "^1.3", diff --git a/php-styler.php b/php-styler.php index 9bacf40..7a8a1a6 100644 --- a/php-styler.php +++ b/php-styler.php @@ -4,7 +4,7 @@ use PhpStyler\Files; use PhpStyler\Styler; return new Config( - files: new Files(__DIR__ . '/src'), styler: new Styler(), + files: new Files(__DIR__ . '/src'), cache: __DIR__ . '/.php-styler.cache', ); diff --git a/src/Bootstrap.php b/src/Bootstrap.php index 5045350..ca8720f 100644 --- a/src/Bootstrap.php +++ b/src/Bootstrap.php @@ -6,6 +6,7 @@ use DI\ContainerBuilder; use Lubian\AttributeMagic\Infrastructure\Event\Dispatcher; use Lubian\AttributeMagic\Infrastructure\Event\DispatcherFactory; use Lubian\AttributeMagic\Infrastructure\Finder; +use Lubian\AttributeMagic\Infrastructure\HttpKernel; use Lubian\AttributeMagic\Infrastructure\WebApp\Request\RequestEvent; use Lubian\AttributeMagic\Infrastructure\WebApp\Route\HandlerResolver; use Symfony\Component\HttpFoundation\Request; @@ -23,9 +24,11 @@ $container = (new ContainerBuilder)->addDefinitions( => new HandlerResolver($d, $cached), ], )->build(); -$dispatcher = $container->get(Dispatcher::class); -assert($dispatcher instanceof Dispatcher); -$request = new RequestEvent(Request::createFromGlobals()); -$dispatcher->dispatch($request); -$request->response?->send(); +$kernel = $container->get(HttpKernel::class); +assert($kernel instanceof HttpKernel); + +$response = $kernel->handle(Request::createFromGlobals()); + +$response->send(); + exit(); diff --git a/src/Handler/HalloDimi.php b/src/Handler/HalloDimi.php index 8a23212..b28a3d7 100644 --- a/src/Handler/HalloDimi.php +++ b/src/Handler/HalloDimi.php @@ -9,6 +9,11 @@ use Symfony\Component\HttpFoundation\Response; final class HalloDimi { + /** + * Returns a JSON response with the message "Hallo Dimi". + * + * @return Response The JSON response. + */ #[AsHandler(HttpMethod::GET, '/dimi')] public function hallo(): Response { diff --git a/src/Infrastructure/HttpKernel.php b/src/Infrastructure/HttpKernel.php new file mode 100644 index 0000000..d3e6ec0 --- /dev/null +++ b/src/Infrastructure/HttpKernel.php @@ -0,0 +1,22 @@ +dispatcher->dispatch($requestEvent); + + return $requestEvent->response ?? throw new \Exception('errror'); + } +} \ No newline at end of file