This commit is contained in:
2021-03-03 18:35:04 +08:00
parent 1c6cde4133
commit c337280d4e
25 changed files with 533 additions and 499 deletions
+12 -5
View File
@@ -4,20 +4,17 @@
namespace Annotation\Route;
use Annotation\IAnnotation;
use Annotation\Attribute;
use JetBrains\PhpStorm\Pure;
use ReflectionException;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake;
/**
* Class Interceptor
* @package Annotation\Route
*/
#[\Attribute(\Attribute::TARGET_METHOD)] class Interceptor implements IAnnotation
#[\Attribute(\Attribute::TARGET_METHOD)] class Interceptor extends Attribute
{
use Node;
/**
* Interceptor constructor.
@@ -29,6 +26,16 @@ use Snowflake\Snowflake;
if (is_string($this->interceptor)) {
$this->interceptor = [$this->interceptor];
}
foreach ($this->interceptor as $key => $value) {
$sn = Snowflake::createObject($value);
if (!($sn instanceof \HttpServer\IInterface\Interceptor)) {
continue;
}
$this->interceptor[$key] = [$sn, 'Interceptor'];
}
}