- Fixed route generating (removed methods)
This commit is contained in:
parent
b24bbbc150
commit
830a643a56
|
@ -160,13 +160,15 @@ PATTERN;
|
||||||
$this->eventExecute(UrlRegisterRouteEvent::class, $name, $array);
|
$this->eventExecute(UrlRegisterRouteEvent::class, $name, $array);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function findRoute(string $name, string $method = "GET") : false|array
|
protected function findRoute(string $name, string $method = "*") : false|array
|
||||||
{
|
{
|
||||||
foreach($this->routes as $route) {
|
foreach($this->routes as $route) {
|
||||||
if ( ($route['name'] === $name) && in_array(strtoupper($method), $route['routeMethods']) ) {
|
if ( $route['name'] === $name ) {
|
||||||
|
if ($method === '*' || in_array(strtoupper($method), $route['routeMethods']) ) {
|
||||||
return $route;
|
return $route;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -287,7 +289,7 @@ PATTERN;
|
||||||
if ($default ?? false) {
|
if ($default ?? false) {
|
||||||
$value = $default;
|
$value = $default;
|
||||||
}
|
}
|
||||||
elseif ( ! str_contains($route, "[{$matches[0][0]}]") && ! str_contains($route, "[/{$matches[0][0]}]") && $this->enforceExistingArguments) {
|
elseif ( $this->enforceExistingArguments && ! preg_match(sprintf("/\[\/?%s]/i", $item[0]), $route) ) {
|
||||||
throw new \RuntimeException(sprintf("Error while preparing route %s : could not match variable '%s' into given arguments ( %s ) from %s::%s", $route, $variable, json_encode($arguments), $routeParam['class'], $routeParam['classMethod']));
|
throw new \RuntimeException(sprintf("Error while preparing route %s : could not match variable '%s' into given arguments ( %s ) from %s::%s", $route, $variable, json_encode($arguments), $routeParam['class'], $routeParam['classMethod']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue