This commit is contained in:
2020-09-16 20:57:50 +08:00
parent 92ff227121
commit 7db78f5edf
+16 -8
View File
@@ -116,14 +116,16 @@ class Annotation extends \Snowflake\Annotation\Annotation
* @param $annotation * @param $annotation
* @throws * @throws
*/ */
private function bindMiddleware($node, $annotation) private function bindMiddleware(Node $node, $annotation)
{ {
if (!isset($annotation[1][2])) { if (!isset($annotation[1][2])) {
return; return;
} }
$explode = explode(',', $annotation[1][2]); $explode = explode(',', $annotation[1][2]);
foreach ($explode as $middleware) { foreach ($explode as $middleware) {
$middleware = 'App\Http\Middleware\\' . $middleware; if (strpos($middleware, '\\') !== 0) {
$middleware = 'App\Http\Middleware\\' . $middleware;
}
if (!class_exists($middleware)) { if (!class_exists($middleware)) {
continue; continue;
} }
@@ -137,14 +139,16 @@ class Annotation extends \Snowflake\Annotation\Annotation
* @param $annotation * @param $annotation
* @throws * @throws
*/ */
private function bindInterceptors($node, $annotation) private function bindInterceptors(Node $node, $annotation)
{ {
if (!isset($annotation[1][2])) { if (!isset($annotation[1][2])) {
return; return;
} }
$explode = explode(',', $annotation[1][2]); $explode = explode(',', $annotation[1][2]);
foreach ($explode as $middleware) { foreach ($explode as $middleware) {
$middleware = 'App\Http\Interceptor\\' . $middleware; if (strpos($middleware, '\\') !== 0) {
$middleware = 'App\Http\Interceptor\\' . $middleware;
}
if (!class_exists($middleware)) { if (!class_exists($middleware)) {
continue; continue;
} }
@@ -162,7 +166,7 @@ class Annotation extends \Snowflake\Annotation\Annotation
* @param $annotation * @param $annotation
* @throws * @throws
*/ */
private function bindAfter($node, $annotation) private function bindAfter(Node $node, $annotation)
{ {
if (!isset($annotation[1][2])) { if (!isset($annotation[1][2])) {
return; return;
@@ -170,7 +174,9 @@ class Annotation extends \Snowflake\Annotation\Annotation
$explode = explode(',', $annotation[1][2]); $explode = explode(',', $annotation[1][2]);
foreach ($explode as $middleware) { foreach ($explode as $middleware) {
$middleware = 'App\Http\After\\' . $middleware; if (strpos($middleware, '\\') !== 0) {
$middleware = 'App\Http\After\\' . $middleware;
}
if (!class_exists($middleware)) { if (!class_exists($middleware)) {
continue; continue;
} }
@@ -188,7 +194,7 @@ class Annotation extends \Snowflake\Annotation\Annotation
* @param $annotation * @param $annotation
* @throws * @throws
*/ */
private function bindLimits($node, $annotation) private function bindLimits(Node $node, $annotation)
{ {
if (!isset($annotation[1][2])) { if (!isset($annotation[1][2])) {
return; return;
@@ -196,7 +202,9 @@ class Annotation extends \Snowflake\Annotation\Annotation
$explode = explode(',', $annotation[1][2]); $explode = explode(',', $annotation[1][2]);
foreach ($explode as $middleware) { foreach ($explode as $middleware) {
$middleware = 'App\Http\Limits\\' . $middleware; if (strpos($middleware, '\\') !== 0) {
$middleware = 'App\Http\Limits\\' . $middleware;
}
if (!class_exists($middleware)) { if (!class_exists($middleware)) {
continue; continue;
} }