变更
This commit is contained in:
@@ -14,28 +14,28 @@ class Get extends AbstractRequestMethod implements InjectRouteInterface
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @param string $version
|
||||
*/
|
||||
public function __construct(readonly public string $path)
|
||||
public function __construct(readonly public string $path, readonly public string $version = 'v1')
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $method
|
||||
* @return void
|
||||
* @throws ReflectionException
|
||||
* @throws Exception
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function dispatch(object $class, string $method): void
|
||||
{
|
||||
// TODO: Implement dispatch() method.
|
||||
Router::addRoute(RequestMethod::REQUEST_GET, $this->path, [$class, $method]);
|
||||
$path = $this->version . '/' . ltrim($this->path, '/');
|
||||
|
||||
Router::addRoute(RequestMethod::REQUEST_GET, $path, [$class, $method]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user