改名
This commit is contained in:
@@ -67,35 +67,4 @@ class OnClose extends Callback
|
|||||||
$logger->insert();
|
$logger->insert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $server
|
|
||||||
* @param $fd
|
|
||||||
* @return array|null
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function resolve($server, $fd): ?array
|
|
||||||
{
|
|
||||||
if ($server instanceof WServer) {
|
|
||||||
if (!$server->isEstablished($fd)) {
|
|
||||||
return [null, null];
|
|
||||||
}
|
|
||||||
$router = Snowflake::app()->getRouter();
|
|
||||||
$node = $router->search(Socket::HANDSHAKE . '::' . null, 'sw::socket');
|
|
||||||
if ($node === null) {
|
|
||||||
return [null, null];
|
|
||||||
}
|
|
||||||
return $node->dispatch();
|
|
||||||
} else if ($server instanceof HServer) {
|
|
||||||
$manager = Snowflake::app()->annotation->http;
|
|
||||||
$name = $manager->getName(Http::CLOSE);
|
|
||||||
} else {
|
|
||||||
$manager = Snowflake::app()->annotation->tcp;
|
|
||||||
$name = $manager->getName(Tcp::CLOSE);
|
|
||||||
}
|
|
||||||
return [$manager, $name];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,22 +198,16 @@ class Node extends Application
|
|||||||
* @return null|array
|
* @return null|array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function getReflect(string $controller, string $action)
|
private function getReflect(string $controller, string $action): ?array
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$reflect = Snowflake::getDi()->getReflect($controller);
|
$reflect = Snowflake::getDi()->getReflect($controller);
|
||||||
if (!$reflect->isInstantiable()) {
|
if (!$reflect->isInstantiable()) {
|
||||||
throw new Exception($controller . ' Class is con\'t Instantiable.');
|
throw new Exception($controller . ' Class is con\'t Instantiable.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($action) && !$reflect->hasMethod($action)) {
|
if (!empty($action) && !$reflect->hasMethod($action)) {
|
||||||
throw new Exception('method ' . $action . ' not exists at ' . $controller . '.');
|
throw new Exception('method ' . $action . ' not exists at ' . $controller . '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$annotation = Snowflake::app()->annotation->http;
|
|
||||||
if (!empty($annotations = $annotation->getAnnotation(Http::class))) {
|
|
||||||
$annotation->read($this, $reflect, $action, $annotations);
|
|
||||||
}
|
|
||||||
return [$reflect->newInstance(), $action];
|
return [$reflect->newInstance(), $action];
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
$this->_error = $exception->getMessage();
|
$this->_error = $exception->getMessage();
|
||||||
|
|||||||
@@ -588,16 +588,6 @@ class Router extends Application implements RouterInterface
|
|||||||
*/
|
*/
|
||||||
public function loadRouterSetting()
|
public function loadRouterSetting()
|
||||||
{
|
{
|
||||||
$prefix = APP_PATH . 'app/Http/';
|
|
||||||
|
|
||||||
/** @var Http $annotation */
|
|
||||||
$annotation = Snowflake::app()->annotation;
|
|
||||||
|
|
||||||
$annotation = $annotation->http;
|
|
||||||
$annotation->registration_notes($prefix . 'Interceptor', 'App\Http\Interceptor');
|
|
||||||
$annotation->registration_notes($prefix . 'Limits', 'App\Http\Limits');
|
|
||||||
$annotation->registration_notes($prefix . 'Middleware', 'App\Http\Middleware');
|
|
||||||
|
|
||||||
$this->loadRouteDir(APP_PATH . '/routes');
|
$this->loadRouteDir(APP_PATH . '/routes');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -207,10 +207,6 @@ class Server extends Application
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// $attributes = Snowflake::app()->getAttributes();
|
|
||||||
// $attributes->readControllers(CONTROLLER_PATH, 'App\Http\Controllers', 'controllers');
|
|
||||||
// $attributes->readControllers(SOCKET_PATH, 'App\Websocket', 'sockets');
|
|
||||||
|
|
||||||
$processes = Config::get('processes');
|
$processes = Config::get('processes');
|
||||||
if (!empty($processes) && is_array($processes)) {
|
if (!empty($processes) && is_array($processes)) {
|
||||||
$this->deliveryProcess(merge($processes, $this->process));
|
$this->deliveryProcess(merge($processes, $this->process));
|
||||||
|
|||||||
Reference in New Issue
Block a user