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
+13 -7
View File
@@ -4,31 +4,37 @@
namespace Annotation\Route;
use Annotation\IAnnotation;
use JetBrains\PhpStorm\Pure;
use ReflectionException;
use Snowflake\Exception\NotFindClassException;
use Annotation\Attribute;
use Snowflake\Snowflake;
/**
* Class Limits
* @package Annotation\Route
*/
#[\Attribute(\Attribute::TARGET_METHOD)] class Limits implements IAnnotation
#[\Attribute(\Attribute::TARGET_METHOD)] class Limits extends Attribute
{
use Node;
/**
* Limits constructor.
* @param string|array $limits
* @throws
*/
#[Pure] public function __construct(public string|array $limits)
public function __construct(public string|array $limits)
{
if (is_string($this->limits)) {
$this->limits = [$this->limits];
}
foreach ($this->limits as $key => $value) {
$sn = Snowflake::createObject($value);
if (!($sn instanceof \HttpServer\IInterface\Limits)) {
continue;
}
$this->limits[$key] = [$sn, 'next'];
}
}