This commit is contained in:
2020-12-16 15:37:23 +08:00
parent f12994dd55
commit 18743e0003
7 changed files with 23 additions and 36 deletions
+2 -14
View File
@@ -15,24 +15,14 @@ use Annotation\IAnnotation;
#[\Attribute(\Attribute::TARGET_METHOD)] class Route implements IAnnotation
{
use \Annotation\Route\Node;
/**
* Route constructor.
* @param string $uri
* @param string $method
* @param array|null $middleware
* @param array|null $interceptor
* @param array|null $limits
* @param array|null $after
*/
public function __construct(
public string $uri,
public string $method,
public ?array $middleware = null,
public ?array $interceptor = null,
public ?array $limits = null,
public ?array $after = null
public string $method
)
{
}
@@ -50,9 +40,7 @@ use Annotation\IAnnotation;
$router = Snowflake::app()->getRouter();
// TODO: Implement setHandler() method.
$node = $router->addRoute($this->uri, $handler, $this->method);
return $this->add($node);
return $router->addRoute($this->uri, $handler, $this->method);
}