This commit is contained in:
2021-02-22 17:44:24 +08:00
parent 3b09b9a308
commit 2d1f83cf09
34 changed files with 732 additions and 222 deletions
+8 -6
View File
@@ -7,6 +7,7 @@ namespace Annotation\Route;
use Closure;
use Exception;
use HttpServer\Route\Node;
use HttpServer\Route\Router;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\ConfigException;
use Snowflake\Snowflake;
@@ -29,18 +30,19 @@ use Annotation\IAnnotation;
/**
* @param array|Closure $handler
* @return ?Node
* @param array $handler
* @return Router
* @throws ComponentException
* @throws ConfigException
* @throws Exception
*/
public function setHandler(array|Closure $handler): ?Node
public function execute(array $handler): Router
{
$router = Snowflake::app()->getRouter();
// TODO: Implement setHandler() method.
$router = Snowflake::app()->getRouter();
return $router->addRoute($this->uri, $handler, $this->method);
$router->addRoute($this->uri, $handler, $this->method);
return $router;
}