改名
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Server\Abstracts;
|
||||
|
||||
use Annotation\Inject;
|
||||
use Http\Route\Router;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Exception\NotFindClassException;
|
||||
use Kiri\Kiri;
|
||||
use ReflectionException;
|
||||
use Server\Constrict\ResponseEmitter;
|
||||
use Server\Constrict\TcpEmitter;
|
||||
use Server\ExceptionHandlerDispatcher;
|
||||
use Server\ExceptionHandlerInterface;
|
||||
use Server\SInterface\OnRequest;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class Http extends Server implements OnRequest
|
||||
{
|
||||
|
||||
|
||||
use EventDispatchHelper;
|
||||
use ResponseHelper;
|
||||
|
||||
/** @var Router|mixed */
|
||||
#[Inject('router')]
|
||||
public Router $router;
|
||||
|
||||
|
||||
/**
|
||||
* @var ExceptionHandlerInterface
|
||||
*/
|
||||
public ExceptionHandlerInterface $exceptionHandler;
|
||||
|
||||
|
||||
/**
|
||||
* @throws ReflectionException
|
||||
* @throws ConfigException
|
||||
* @throws NotFindClassException
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$exceptionHandler = Config::get('exception.http', ExceptionHandlerDispatcher::class);
|
||||
if (!in_array(ExceptionHandlerInterface::class, class_implements($exceptionHandler))) {
|
||||
$exceptionHandler = ExceptionHandlerDispatcher::class;
|
||||
}
|
||||
$this->exceptionHandler = Kiri::getDi()->get($exceptionHandler);
|
||||
$this->responseEmitter = Kiri::getDi()->get(ResponseEmitter::class);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user