改名
This commit is contained in:
@@ -9,7 +9,6 @@ use Exception;
|
|||||||
use HttpServer\Http\Request;
|
use HttpServer\Http\Request;
|
||||||
use HttpServer\Route\Router;
|
use HttpServer\Route\Router;
|
||||||
use JetBrains\PhpStorm\Pure;
|
use JetBrains\PhpStorm\Pure;
|
||||||
use Snowflake\Exception\ConfigException;
|
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
|
|
||||||
|
|
||||||
@@ -32,7 +31,7 @@ use Snowflake\Snowflake;
|
|||||||
* @param string $protocol
|
* @param string $protocol
|
||||||
* @param int $port
|
* @param int $port
|
||||||
*/
|
*/
|
||||||
#[Pure] public function __construct(public string $cmd, public string $protocol, public int $port)
|
#[Pure] public function __construct(public string $cmd, public string $protocol = self::PROTOCOL_SERIALIZE, public int $port = 443)
|
||||||
{
|
{
|
||||||
$this->uri = 'rpc/p' . $this->port . '/' . ltrim($this->cmd, '/');
|
$this->uri = 'rpc/p' . $this->port . '/' . ltrim($this->cmd, '/');
|
||||||
}
|
}
|
||||||
@@ -41,7 +40,6 @@ use Snowflake\Snowflake;
|
|||||||
/**
|
/**
|
||||||
* @param array $handler
|
* @param array $handler
|
||||||
* @return Router
|
* @return Router
|
||||||
* @throws ConfigException
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function execute(array $handler): Router
|
public function execute(array $handler): Router
|
||||||
@@ -49,7 +47,8 @@ use Snowflake\Snowflake;
|
|||||||
// TODO: Implement setHandler() method.
|
// TODO: Implement setHandler() method.
|
||||||
$router = Snowflake::app()->getRouter();
|
$router = Snowflake::app()->getRouter();
|
||||||
|
|
||||||
$router->addRoute($this->uri, $handler, Request::HTTP_CMD);
|
$router->addRoute($this->uri, $handler, Request::HTTP_CMD)
|
||||||
|
->setDataType($this->protocol);
|
||||||
|
|
||||||
return $router;
|
return $router;
|
||||||
}
|
}
|
||||||
|
|||||||
+545
-521
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user