改名
This commit is contained in:
@@ -198,22 +198,16 @@ class Node extends Application
|
||||
* @return null|array
|
||||
* @throws Exception
|
||||
*/
|
||||
private function getReflect(string $controller, string $action)
|
||||
private function getReflect(string $controller, string $action): ?array
|
||||
{
|
||||
try {
|
||||
$reflect = Snowflake::getDi()->getReflect($controller);
|
||||
if (!$reflect->isInstantiable()) {
|
||||
throw new Exception($controller . ' Class is con\'t Instantiable.');
|
||||
}
|
||||
|
||||
if (!empty($action) && !$reflect->hasMethod($action)) {
|
||||
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];
|
||||
} catch (\Throwable $exception) {
|
||||
$this->_error = $exception->getMessage();
|
||||
|
||||
@@ -588,16 +588,6 @@ class Router extends Application implements RouterInterface
|
||||
*/
|
||||
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');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user