Continuous Integration Fixes

This commit is contained in:
Continuous Integration 2023-11-27 20:53:47 +00:00
parent 911c0ff4b5
commit 70d16b7659
2 changed files with 8 additions and 10 deletions

View file

@ -7,7 +7,6 @@ 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;
@ -26,9 +25,6 @@ $container = (new ContainerBuilder)->addDefinitions(
)->build();
$kernel = $container->get(HttpKernel::class);
assert($kernel instanceof HttpKernel);
$response = $kernel->handle(Request::createFromGlobals());
$response->send();
exit();

View file

@ -1,7 +1,8 @@
<?php
<?php declare(strict_types=1);
namespace Lubian\AttributeMagic\Infrastructure;
use Exception;
use Lubian\AttributeMagic\Infrastructure\Event\Dispatcher;
use Lubian\AttributeMagic\Infrastructure\WebApp\Request\RequestEvent;
use Symfony\Component\HttpFoundation\Request;
@ -10,13 +11,14 @@ use Symfony\Component\HttpFoundation\Response;
class HttpKernel
{
public function __construct(
private readonly Dispatcher $dispatcher,
){}
private readonly Dispatcher $dispatcher
) {
}
public function handle(Request $request): Response
{
$requestEvent = new RequestEvent($request);
$this->dispatcher->dispatch($requestEvent);
return $requestEvent->response ?? throw new \Exception('errror');
return $requestEvent->response ?? throw new Exception('errror');
}
}
}