|
|
@ -89,10 +89,11 @@ class Router
|
|
|
|
* @param string $pattern URL pattern to match
|
|
|
|
* @param string $pattern URL pattern to match
|
|
|
|
* @param callable $callback Callback function
|
|
|
|
* @param callable $callback Callback function
|
|
|
|
* @param bool $pass_route Pass the matching route object to the callback
|
|
|
|
* @param bool $pass_route Pass the matching route object to the callback
|
|
|
|
|
|
|
|
* @param string $alias Alias for the route
|
|
|
|
* @return void
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function get(string $pattern, callable $callback, bool $pass_route = false): void {
|
|
|
|
public function get(string $pattern, callable $callback, bool $pass_route = false, string $alias = ''): void {
|
|
|
|
$this->map('GET ' . $pattern, $callback, $pass_route);
|
|
|
|
$this->map('GET ' . $pattern, $callback, $pass_route, $alias);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -101,10 +102,11 @@ class Router
|
|
|
|
* @param string $pattern URL pattern to match
|
|
|
|
* @param string $pattern URL pattern to match
|
|
|
|
* @param callable $callback Callback function
|
|
|
|
* @param callable $callback Callback function
|
|
|
|
* @param bool $pass_route Pass the matching route object to the callback
|
|
|
|
* @param bool $pass_route Pass the matching route object to the callback
|
|
|
|
|
|
|
|
* @param string $alias Alias for the route
|
|
|
|
* @return void
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function post(string $pattern, callable $callback, bool $pass_route = false): void {
|
|
|
|
public function post(string $pattern, callable $callback, bool $pass_route = false, string $alias = ''): void {
|
|
|
|
$this->map('POST ' . $pattern, $callback, $pass_route);
|
|
|
|
$this->map('POST ' . $pattern, $callback, $pass_route, $alias);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -113,10 +115,11 @@ class Router
|
|
|
|
* @param string $pattern URL pattern to match
|
|
|
|
* @param string $pattern URL pattern to match
|
|
|
|
* @param callable $callback Callback function
|
|
|
|
* @param callable $callback Callback function
|
|
|
|
* @param bool $pass_route Pass the matching route object to the callback
|
|
|
|
* @param bool $pass_route Pass the matching route object to the callback
|
|
|
|
|
|
|
|
* @param string $alias Alias for the route
|
|
|
|
* @return void
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function put(string $pattern, callable $callback, bool $pass_route = false): void {
|
|
|
|
public function put(string $pattern, callable $callback, bool $pass_route = false, string $alias = ''): void {
|
|
|
|
$this->map('PUT ' . $pattern, $callback, $pass_route);
|
|
|
|
$this->map('PUT ' . $pattern, $callback, $pass_route, $alias);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -125,10 +128,11 @@ class Router
|
|
|
|
* @param string $pattern URL pattern to match
|
|
|
|
* @param string $pattern URL pattern to match
|
|
|
|
* @param callable $callback Callback function
|
|
|
|
* @param callable $callback Callback function
|
|
|
|
* @param bool $pass_route Pass the matching route object to the callback
|
|
|
|
* @param bool $pass_route Pass the matching route object to the callback
|
|
|
|
|
|
|
|
* @param string $alias Alias for the route
|
|
|
|
* @return void
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function patch(string $pattern, callable $callback, bool $pass_route = false): void {
|
|
|
|
public function patch(string $pattern, callable $callback, bool $pass_route = false, string $alias = ''): void {
|
|
|
|
$this->map('PATCH ' . $pattern, $callback, $pass_route);
|
|
|
|
$this->map('PATCH ' . $pattern, $callback, $pass_route, $alias);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -137,10 +141,11 @@ class Router
|
|
|
|
* @param string $pattern URL pattern to match
|
|
|
|
* @param string $pattern URL pattern to match
|
|
|
|
* @param callable $callback Callback function
|
|
|
|
* @param callable $callback Callback function
|
|
|
|
* @param bool $pass_route Pass the matching route object to the callback
|
|
|
|
* @param bool $pass_route Pass the matching route object to the callback
|
|
|
|
|
|
|
|
* @param string $alias Alias for the route
|
|
|
|
* @return void
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function delete(string $pattern, callable $callback, bool $pass_route = false): void {
|
|
|
|
public function delete(string $pattern, callable $callback, bool $pass_route = false, string $alias = ''): void {
|
|
|
|
$this->map('DELETE ' . $pattern, $callback, $pass_route);
|
|
|
|
$this->map('DELETE ' . $pattern, $callback, $pass_route, $alias);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|