2020-12-16 10:38:03 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Annotation\Route;
|
|
|
|
|
|
|
|
|
|
|
2021-02-22 17:44:24 +08:00
|
|
|
use Annotation\IAnnotation;
|
2021-02-23 14:54:47 +08:00
|
|
|
use JetBrains\PhpStorm\Pure;
|
2021-02-22 17:44:24 +08:00
|
|
|
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 After implements IAnnotation
|
2020-12-16 10:38:03 +08:00
|
|
|
{
|
|
|
|
|
|
2021-02-23 14:45:50 +08:00
|
|
|
use Node;
|
2020-12-16 10:38:03 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Interceptor constructor.
|
2020-12-16 10:40:15 +08:00
|
|
|
* @param \HttpServer\IInterface\After|\HttpServer\IInterface\After[] $after
|
2020-12-16 15:20:51 +08:00
|
|
|
* @throws
|
2020-12-16 10:38:03 +08:00
|
|
|
*/
|
2021-02-23 14:54:47 +08:00
|
|
|
#[Pure] public function __construct(public string|array $after)
|
2020-12-16 10:38:03 +08:00
|
|
|
{
|
2021-02-23 14:45:50 +08:00
|
|
|
if (is_string($this->after)) {
|
2021-02-23 14:54:47 +08:00
|
|
|
$this->after = [$this->after];
|
2021-02-23 14:45:50 +08:00
|
|
|
}
|
2021-02-22 17:44:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param array $handler
|
2021-02-23 14:18:49 +08:00
|
|
|
* @return After
|
2021-02-22 17:44:24 +08:00
|
|
|
*/
|
2021-02-23 14:18:49 +08:00
|
|
|
public function execute(array $handler): static
|
2021-02-22 17:44:24 +08:00
|
|
|
{
|
2021-02-23 14:16:08 +08:00
|
|
|
return $this;
|
2020-12-16 10:38:03 +08:00
|
|
|
}
|
|
|
|
|
|
2021-02-22 17:44:24 +08:00
|
|
|
|
2020-12-16 10:38:03 +08:00
|
|
|
}
|