改名
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
namespace HttpServer\Route\Annotation;
|
namespace HttpServer\Route\Annotation;
|
||||||
|
|
||||||
|
use HttpServer\IInterface\Interceptor;
|
||||||
|
use HttpServer\IInterface\Limits;
|
||||||
use HttpServer\Route\Node;
|
use HttpServer\Route\Node;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
use ReflectionException;
|
use ReflectionException;
|
||||||
@@ -105,7 +107,6 @@ class Annotation extends \Snowflake\Annotation\Annotation
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Node $node
|
* @param Node $node
|
||||||
* @param $annotation
|
* @param $annotation
|
||||||
@@ -142,6 +143,17 @@ class Annotation extends \Snowflake\Annotation\Annotation
|
|||||||
|
|
||||||
[$keyName, $matchs] = $annotation;
|
[$keyName, $matchs] = $annotation;
|
||||||
foreach ($explode as $middleware) {
|
foreach ($explode as $middleware) {
|
||||||
|
$middleware = 'App\Http\Interceptor\\' . $middleware;
|
||||||
|
if (!class_exists($middleware)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$middleware = Snowflake::createObject($middleware);
|
||||||
|
if (!($middleware instanceof Interceptor)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$node->addInterceptor([$middleware, 'Interceptor']);
|
||||||
|
continue;
|
||||||
|
|
||||||
$params = [$keyName, [$matchs[0], $matchs[1], $middleware]];
|
$params = [$keyName, [$matchs[0], $matchs[1], $middleware]];
|
||||||
$node->addInterceptor($this->pop($this->getName(...$params)));
|
$node->addInterceptor($this->pop($this->getName(...$params)));
|
||||||
}
|
}
|
||||||
@@ -163,6 +175,17 @@ class Annotation extends \Snowflake\Annotation\Annotation
|
|||||||
|
|
||||||
[$keyName, $matchs] = $annotation;
|
[$keyName, $matchs] = $annotation;
|
||||||
foreach ($explode as $middleware) {
|
foreach ($explode as $middleware) {
|
||||||
|
$middleware = 'App\Http\Limits\\' . $middleware;
|
||||||
|
if (!class_exists($middleware)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$middleware = Snowflake::createObject($middleware);
|
||||||
|
if (!($middleware instanceof Limits)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$node->addLimits([$middleware, 'next']);
|
||||||
|
continue;
|
||||||
|
|
||||||
$params = [$keyName, [$matchs[0], $matchs[1], $middleware]];
|
$params = [$keyName, [$matchs[0], $matchs[1], $middleware]];
|
||||||
$node->addLimits($this->pop($this->getName(...$params)));
|
$node->addLimits($this->pop($this->getName(...$params)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class Middleware
|
|||||||
return $this->annotation_limit($node, $middleWares);
|
return $this->annotation_limit($node, $middleWares);
|
||||||
}
|
}
|
||||||
foreach ($node->getInterceptor() as $item) {
|
foreach ($node->getInterceptor() as $item) {
|
||||||
$middleWares[] = $item[0];
|
$middleWares[] = $item;
|
||||||
}
|
}
|
||||||
return $this->annotation_limit($node, $middleWares);
|
return $this->annotation_limit($node, $middleWares);
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ class Middleware
|
|||||||
return $middleWares;
|
return $middleWares;
|
||||||
}
|
}
|
||||||
foreach ($node->getLimits() as $item) {
|
foreach ($node->getLimits() as $item) {
|
||||||
$middleWares[] = $item[0];
|
$middleWares[] = $item;
|
||||||
}
|
}
|
||||||
return $middleWares;
|
return $middleWares;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user