Update Composer packages

This commit is contained in:
Paul Nicoué 2023-04-14 16:30:28 +02:00
parent d482354bdf
commit e7e7361480
219 changed files with 6487 additions and 4444 deletions

View file

@ -117,7 +117,10 @@ class Router
if ($callback) {
$result = $callback($route);
} else {
$result = $route?->action()->call($route, ...$route->arguments());
$result = $route->action()->call(
$route,
...$route->arguments()
);
}
$loop = false;
@ -139,8 +142,12 @@ class Router
* the routing action immediately
* @since 3.7.0
*/
public static function execute(string|null $path = null, string $method = 'GET', array $routes = [], Closure|null $callback = null)
{
public static function execute(
string|null $path = null,
string $method = 'GET',
array $routes = [],
Closure|null $callback = null
) {
return (new static($routes))->call($path, $method, $callback);
}
@ -150,8 +157,11 @@ class Router
* find matches and return all the found
* arguments in the path.
*/
public function find(string $path, string $method, array|null $ignore = null): Route|null
{
public function find(
string $path,
string $method,
array|null $ignore = null
): Route {
if (isset($this->routes[$method]) === false) {
throw new InvalidArgumentException('Invalid routing method: ' . $method, 400);
}
@ -163,7 +173,10 @@ class Router
$arguments = $route->parse($route->pattern(), $path);
if ($arguments !== false) {
if (empty($ignore) === true || in_array($route, $ignore) === false) {
if (
empty($ignore) === true ||
in_array($route, $ignore) === false
) {
return $this->route = $route;
}
}