| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -56,12 +56,20 @@ class Router
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     *
 | 
					 | 
					 | 
					 | 
					     *
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @var array<int, string>
 | 
					 | 
					 | 
					 | 
					     * @var array<int, string>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */
 | 
					 | 
					 | 
					 | 
					     */
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    protected array $allowedMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'];
 | 
					 | 
					 | 
					 | 
					    protected array $allowedMethods = [
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        'GET',
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        'POST',
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        'PUT',
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        'PATCH',
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        'DELETE',
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        'HEAD',
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        'OPTIONS'
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    ];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /**
 | 
					 | 
					 | 
					 | 
					    /**
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * Gets mapped routes.
 | 
					 | 
					 | 
					 | 
					     * Gets mapped routes.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     *
 | 
					 | 
					 | 
					 | 
					     *
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @return array<int,Route> Array of routes
 | 
					 | 
					 | 
					 | 
					     * @return array<int, Route> Array of routes
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */
 | 
					 | 
					 | 
					 | 
					     */
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public function getRoutes(): array
 | 
					 | 
					 | 
					 | 
					    public function getRoutes(): array
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					    {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -80,7 +88,7 @@ class Router
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * Maps a URL pattern to a callback function.
 | 
					 | 
					 | 
					 | 
					     * Maps a URL pattern to a callback function.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     *
 | 
					 | 
					 | 
					 | 
					     *
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param string $pattern URL pattern to match.
 | 
					 | 
					 | 
					 | 
					     * @param string $pattern URL pattern to match.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param callable|string $callback Callback function or string class->method
 | 
					 | 
					 | 
					 | 
					     * @param callable|string|array{0: class-string, 1: string} $callback Callback function or string `class->method`
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @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 $route_alias Alias for the route.
 | 
					 | 
					 | 
					 | 
					     * @param string $route_alias Alias for the route.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */
 | 
					 | 
					 | 
					 | 
					     */
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -133,7 +141,7 @@ class Router
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * Creates a GET based route
 | 
					 | 
					 | 
					 | 
					     * Creates a GET based route
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     *
 | 
					 | 
					 | 
					 | 
					     *
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param string   $pattern    URL pattern to match
 | 
					 | 
					 | 
					 | 
					     * @param string   $pattern    URL pattern to match
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param callable|string $callback Callback function or string class->method
 | 
					 | 
					 | 
					 | 
					     * @param callable|string|array{0: class-string, 1: string} $callback Callback function or string `class->method`
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @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
 | 
					 | 
					 | 
					 | 
					     * @param string   $alias      Alias for the route
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */
 | 
					 | 
					 | 
					 | 
					     */
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -146,7 +154,7 @@ class Router
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * Creates a POST based route
 | 
					 | 
					 | 
					 | 
					     * Creates a POST based route
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     *
 | 
					 | 
					 | 
					 | 
					     *
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param string   $pattern    URL pattern to match
 | 
					 | 
					 | 
					 | 
					     * @param string   $pattern    URL pattern to match
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param callable|string $callback Callback function or string class->method
 | 
					 | 
					 | 
					 | 
					     * @param callable|string|array{0: class-string, 1: string} $callback Callback function or string `class->method`
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @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
 | 
					 | 
					 | 
					 | 
					     * @param string   $alias      Alias for the route
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */
 | 
					 | 
					 | 
					 | 
					     */
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -159,7 +167,7 @@ class Router
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * Creates a PUT based route
 | 
					 | 
					 | 
					 | 
					     * Creates a PUT based route
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     *
 | 
					 | 
					 | 
					 | 
					     *
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param string   $pattern    URL pattern to match
 | 
					 | 
					 | 
					 | 
					     * @param string   $pattern    URL pattern to match
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param callable|string $callback Callback function or string class->method
 | 
					 | 
					 | 
					 | 
					     * @param callable|string|array{0: class-string, 1: string} $callback Callback function or string `class->method`
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @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
 | 
					 | 
					 | 
					 | 
					     * @param string   $alias      Alias for the route
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */
 | 
					 | 
					 | 
					 | 
					     */
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -172,7 +180,7 @@ class Router
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * Creates a PATCH based route
 | 
					 | 
					 | 
					 | 
					     * Creates a PATCH based route
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     *
 | 
					 | 
					 | 
					 | 
					     *
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param string   $pattern    URL pattern to match
 | 
					 | 
					 | 
					 | 
					     * @param string   $pattern    URL pattern to match
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param callable|string $callback Callback function or string class->method
 | 
					 | 
					 | 
					 | 
					     * @param callable|string|array{0: class-string, 1: string} $callback Callback function or string `class->method`
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @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
 | 
					 | 
					 | 
					 | 
					     * @param string   $alias      Alias for the route
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */
 | 
					 | 
					 | 
					 | 
					     */
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -185,7 +193,7 @@ class Router
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * Creates a DELETE based route
 | 
					 | 
					 | 
					 | 
					     * Creates a DELETE based route
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     *
 | 
					 | 
					 | 
					 | 
					     *
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param string   $pattern    URL pattern to match
 | 
					 | 
					 | 
					 | 
					     * @param string   $pattern    URL pattern to match
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param callable|string $callback Callback function or string class->method
 | 
					 | 
					 | 
					 | 
					     * @param callable|string|array{0: class-string, 1: string} $callback Callback function or string `class->method`
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @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
 | 
					 | 
					 | 
					 | 
					     * @param string   $alias      Alias for the route
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */
 | 
					 | 
					 | 
					 | 
					     */
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -199,7 +207,7 @@ class Router
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     *
 | 
					 | 
					 | 
					 | 
					     *
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param string $groupPrefix group URL prefix (such as /api/v1)
 | 
					 | 
					 | 
					 | 
					     * @param string $groupPrefix group URL prefix (such as /api/v1)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param callable $callback The necessary calling that holds the Router class
 | 
					 | 
					 | 
					 | 
					     * @param callable $callback The necessary calling that holds the Router class
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param array<int, callable|object> $groupMiddlewares
 | 
					 | 
					 | 
					 | 
					     * @param (class-string|callable|array{0: class-string, 1: string})[] $groupMiddlewares
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * The middlewares to be applied to the group. Example: `[$middleware1, $middleware2]`
 | 
					 | 
					 | 
					 | 
					     * The middlewares to be applied to the group. Example: `[$middleware1, $middleware2]`
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */
 | 
					 | 
					 | 
					 | 
					     */
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public function group(string $groupPrefix, callable $callback, array $groupMiddlewares = []): void
 | 
					 | 
					 | 
					 | 
					    public function group(string $groupPrefix, callable $callback, array $groupMiddlewares = []): void
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -226,7 +234,7 @@ class Router
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if ($urlMatches === true && $methodMatches === true) {
 | 
					 | 
					 | 
					 | 
					            if ($urlMatches === true && $methodMatches === true) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $this->executedRoute = $route;
 | 
					 | 
					 | 
					 | 
					                $this->executedRoute = $route;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return $route;
 | 
					 | 
					 | 
					 | 
					                return $route;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            // capture the route but don't execute it. We'll use this in Engine->start() to throw a 405
 | 
					 | 
					 | 
					 | 
					                // capture the route but don't execute it. We'll use this in Engine->start() to throw a 405
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } elseif ($urlMatches === true && $methodMatches === false) {
 | 
					 | 
					 | 
					 | 
					            } elseif ($urlMatches === true && $methodMatches === false) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $this->executedRoute = $route;
 | 
					 | 
					 | 
					 | 
					                $this->executedRoute = $route;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -240,7 +248,7 @@ class Router
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * Gets the URL for a given route alias
 | 
					 | 
					 | 
					 | 
					     * Gets the URL for a given route alias
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     *
 | 
					 | 
					 | 
					 | 
					     *
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param string $alias  the alias to match
 | 
					 | 
					 | 
					 | 
					     * @param string $alias  the alias to match
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param array<string,mixed>  $params the parameters to pass to the route
 | 
					 | 
					 | 
					 | 
					     * @param array<string, mixed>  $params the parameters to pass to the route
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */
 | 
					 | 
					 | 
					 | 
					     */
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public function getUrlByAlias(string $alias, array $params = []): string
 | 
					 | 
					 | 
					 | 
					    public function getUrlByAlias(string $alias, array $params = []): string
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					    {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -311,7 +319,7 @@ class Router
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return in_array($key, $only, true) === true;
 | 
					 | 
					 | 
					 | 
					                return in_array($key, $only, true) === true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }, ARRAY_FILTER_USE_KEY);
 | 
					 | 
					 | 
					 | 
					            }, ARRAY_FILTER_USE_KEY);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // Exclude these controller methods
 | 
					 | 
					 | 
					 | 
					            // Exclude these controller methods
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } elseif (isset($options['except']) === true) {
 | 
					 | 
					 | 
					 | 
					        } elseif (isset($options['except']) === true) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $except = $options['except'];
 | 
					 | 
					 | 
					 | 
					            $except = $options['except'];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $defaultMapping = array_filter($defaultMapping, function ($key) use ($except) {
 | 
					 | 
					 | 
					 | 
					            $defaultMapping = array_filter($defaultMapping, function ($key) use ($except) {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -331,7 +339,7 @@ class Router
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                foreach ($defaultMapping as $controllerMethod => $methodPattern) {
 | 
					 | 
					 | 
					 | 
					                foreach ($defaultMapping as $controllerMethod => $methodPattern) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $router->map(
 | 
					 | 
					 | 
					 | 
					                    $router->map(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $methodPattern,
 | 
					 | 
					 | 
					 | 
					                        $methodPattern,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        [ $controllerClass, $controllerMethod ]
 | 
					 | 
					 | 
					 | 
					                        [$controllerClass, $controllerMethod]
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    )->setAlias($aliasBase . '.' . $controllerMethod);
 | 
					 | 
					 | 
					 | 
					                    )->setAlias($aliasBase . '.' . $controllerMethod);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            },
 | 
					 | 
					 | 
					 | 
					            },
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |