This commit is contained in:
2023-12-12 15:35:35 +08:00
parent 968d572e84
commit 65d41ab868
29 changed files with 646 additions and 701 deletions
+14 -15
View File
@@ -20,26 +20,25 @@ class Delete extends AbstractRequestMethod implements InjectRouteInterface
* @param string $version
*/
public function __construct(readonly public string $path, readonly public string $version = '')
{
}
{
}
/**
* @param object $class
* @param string $method
* @return void
* @throws ReflectionException
* @throws Exception
*/
public function dispatch(object $class, string $method): void
{
// TODO: Implement dispatch() method.
$path = '/' . ltrim($this->path, '/');
/**
* @param object $class
* @param string $method
* @return void
* @throws
*/
public function dispatch(object $class, string $method): void
{
// TODO: Implement dispatch() method.
$path = '/' . ltrim($this->path, '/');
if (!empty($this->version)) {
$path = '/' . trim($this->version) . $path;
}
Router::addRoute(RequestMethod::REQUEST_DELETE, $path, [$class, $method]);
}
Router::addRoute(RequestMethod::REQUEST_DELETE, $path, [$class, $method]);
}
}
+1 -2
View File
@@ -28,8 +28,7 @@ class Get extends AbstractRequestMethod implements InjectRouteInterface
* @param object $class
* @param string $method
* @return void
* @throws ReflectionException
* @throws Exception
* @throws
*/
public function dispatch(object $class, string $method): void
{
+15 -16
View File
@@ -18,27 +18,26 @@ class Head extends AbstractRequestMethod implements InjectRouteInterface
* @param string $path
* @param string $version
*/
public function __construct(readonly public string $path, readonly public string $version = '')
{
}
public function __construct(readonly public string $path, readonly public string $version = '')
{
}
/**
* @param object $class
* @param string $method
* @return void
* @throws ReflectionException
* @throws Exception
*/
public function dispatch(object $class, string $method): void
{
// TODO: Implement dispatch() method.
$path = '/' . ltrim($this->path, '/');
/**
* @param object $class
* @param string $method
* @return void
* @throws
*/
public function dispatch(object $class, string $method): void
{
// TODO: Implement dispatch() method.
$path = '/' . ltrim($this->path, '/');
if (!empty($this->version)) {
$path = '/' . trim($this->version) . $path;
}
Router::addRoute(RequestMethod::REQUEST_HEAD, $path, [$class, $method]);
}
Router::addRoute(RequestMethod::REQUEST_HEAD, $path, [$class, $method]);
}
}
+1 -2
View File
@@ -27,8 +27,7 @@ class Options extends AbstractRequestMethod implements InjectRouteInterface
* @param object $class
* @param string $method
* @return void
* @throws ReflectionException
* @throws Exception
* @throws
*/
public function dispatch(object $class, string $method): void
{
+1 -2
View File
@@ -28,8 +28,7 @@ class Post extends AbstractRequestMethod implements InjectRouteInterface
* @param object $class
* @param string $method
* @return void
* @throws ReflectionException
* @throws Exception
* @throws
*/
public function dispatch(object $class, string $method): void
{
+15 -16
View File
@@ -19,26 +19,25 @@ class Put extends AbstractRequestMethod implements InjectRouteInterface
* @param string $path
* @param string $version
*/
public function __construct(readonly public string $path, readonly public string $version = '')
{
}
public function __construct(readonly public string $path, readonly public string $version = '')
{
}
/**
* @param object $class
* @param string $method
* @return void
* @throws ReflectionException
* @throws Exception
*/
public function dispatch(object $class, string $method): void
{
// TODO: Implement dispatch() method.
$path = '/' . ltrim($this->path, '/');
/**
* @param object $class
* @param string $method
* @return void
* @throws
*/
public function dispatch(object $class, string $method): void
{
// TODO: Implement dispatch() method.
$path = '/' . ltrim($this->path, '/');
if (!empty($this->version)) {
$path = '/' . trim($this->version) . $path;
}
Router::addRoute(RequestMethod::REQUEST_PUT, $path, [$class, $method]);
}
Router::addRoute(RequestMethod::REQUEST_PUT, $path, [$class, $method]);
}
}
-1
View File
@@ -26,7 +26,6 @@ class Route extends AbstractRequestMethod implements InjectRouteInterface
* @param object $class
* @param string $method
* @return void
* @throws ReflectionException
*/
public function dispatch(object $class, string $method): void
{