- Fixed route generating (removed methods)
This commit is contained in:
		
							parent
							
								
									b24bbbc150
								
							
						
					
					
						commit
						830a643a56
					
				| @ -160,11 +160,13 @@ 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 ) { | ||||||
|                 return $route; |                 if ($method === '*' || in_array(strtoupper($method), $route['routeMethods']) ) { | ||||||
|  |                     return $route; | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| @ -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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user