改名
This commit is contained in:
@@ -7,6 +7,7 @@ namespace HttpServer\Route;
|
||||
use HttpServer\Http\Request;
|
||||
use Exception;
|
||||
use HttpServer\Application;
|
||||
use HttpServer\Route\Annotation\Annotation;
|
||||
use Snowflake\Snowflake;
|
||||
|
||||
/**
|
||||
@@ -36,6 +37,8 @@ class Node extends Application
|
||||
public $middleware = [];
|
||||
public $callback = [];
|
||||
|
||||
private $_interceptors = [];
|
||||
|
||||
/**
|
||||
* @param $handler
|
||||
* @return Node
|
||||
@@ -118,7 +121,7 @@ class Node extends Application
|
||||
private function getReflect(string $controller, string $action)
|
||||
{
|
||||
try {
|
||||
$reflect = new \ReflectionClass($controller);
|
||||
$reflect = Snowflake::getDi()->getReflect($controller);
|
||||
if (!$reflect->isInstantiable()) {
|
||||
throw new Exception($controller . ' Class is con\'t Instantiable.');
|
||||
}
|
||||
@@ -126,6 +129,15 @@ class Node extends Application
|
||||
if (!empty($action) && !$reflect->hasMethod($action)) {
|
||||
throw new Exception('method ' . $action . ' not exists at ' . $controller . '.');
|
||||
}
|
||||
|
||||
/** @var Annotation $annotation */
|
||||
$annotation = Snowflake::createObject(Annotation::class);
|
||||
if (!empty($methods)) {
|
||||
$annotations = $annotation->instance($reflect);
|
||||
if (isset($annotations['Interceptor'])) {
|
||||
}
|
||||
|
||||
}
|
||||
return [$reflect->newInstance(), $action];
|
||||
} catch (Exception $exception) {
|
||||
$this->_error = $exception->getMessage();
|
||||
|
||||
Reference in New Issue
Block a user