Files
kiri-core/Annotation/Route/Interceptor.php
T

44 lines
708 B
PHP
Raw Normal View History

2020-12-16 10:38:03 +08:00
<?php
namespace Annotation\Route;
2021-02-22 17:44:24 +08:00
use Annotation\IAnnotation;
use ReflectionException;
use Snowflake\Exception\NotFindClassException;
2020-12-16 15:20:51 +08:00
use Snowflake\Snowflake;
2020-12-16 10:38:03 +08:00
/**
* Class Interceptor
* @package Annotation\Route
*/
2021-02-22 17:44:24 +08:00
#[\Attribute(\Attribute::TARGET_METHOD)] class Interceptor implements IAnnotation
2020-12-16 10:38:03 +08:00
{
/**
* Interceptor constructor.
* @param string|array $interceptor
2020-12-16 15:20:51 +08:00
* @throws
2020-12-16 10:38:03 +08:00
*/
public function __construct(public string|array $interceptor)
{
2021-02-22 17:44:24 +08:00
if (!is_string($this->interceptor)) {
return;
2020-12-16 15:20:51 +08:00
}
2021-02-22 17:44:24 +08:00
$this->interceptor = [$this->interceptor];
}
/**
* @param array $handler
* @return array|string
*/
public function execute(array $handler): array|string
{
2021-02-23 14:16:08 +08:00
return $this;
2020-12-16 10:38:03 +08:00
}
}