This commit is contained in:
2021-10-26 10:35:41 +08:00
parent fdd5608367
commit 90b22a14e0
2 changed files with 13 additions and 5 deletions
-5
View File
@@ -50,9 +50,6 @@ class Server extends HttpService
/** @var ContainerInterface */
#[Inject(ContainerInterface::class)]
public ContainerInterface $container;
/**
@@ -60,8 +57,6 @@ class Server extends HttpService
*/
public function init()
{
$this->container->mapping(RequestInterface::class, Request::class);
$this->container->mapping(ResponseInterface::class, Response::class);
}
+13
View File
@@ -6,7 +6,12 @@ namespace Server;
use Annotation\Inject;
use Exception;
use Http\Constrict\Request;
use Http\Constrict\RequestInterface;
use Http\Constrict\Response;
use Http\Constrict\ResponseInterface;
use Kiri\Abstracts\Config;
use Kiri\Di\ContainerInterface;
use Kiri\Events\EventProvider;
use Kiri\Exception\ConfigException;
use Kiri\Kiri;
@@ -41,6 +46,11 @@ class ServerCommand extends Command
public EventProvider $eventProvider;
/** @var ContainerInterface */
#[Inject(ContainerInterface::class)]
public ContainerInterface $container;
/**
*
*/
@@ -62,6 +72,9 @@ class ServerCommand extends Command
public function execute(InputInterface $input, OutputInterface $output): int
{
try {
$this->container->mapping(RequestInterface::class, Request::class);
$this->container->mapping(ResponseInterface::class, Response::class);
$manager = Kiri::app()->getServer();
$manager->setDaemon((int)is_null($input->getOption('daemon')));
if (!in_array($input->getArgument('action'), self::ACTIONS)) {