public function execute(WP $wp, WP_Query $wp_query)
    {
        // If error occurs, do not search for any route.
        // Immediately process to the `404` route.
        if ($this->conditions->is('404')) {
            return $this->prepareResponse(
                $this->resolveNotFoundRoute(),
                Response::HTTP_NOT_FOUND
            );
        }

        foreach ($this->routes->getGroup($_SERVER['REQUEST_METHOD']) as $route) {
            // First we check if path matches any path
            // pattern or wordpress condition.
            if ($route->matches($wp->request, array_filter($wp_query->query_vars))) {
                // We find a match so return and break from the loop.
                return $this->prepareResponse($route->run());
            }
        }

        throw new RoutingException("Route not found. Couldn't find any matching route.");
    }
public function execute(WP $wp, WP_Query $wp_query)
    {
        // If error occurs, do not search for any route.
        // Immediately process to the `404` route.
        if ($this->conditions->is('404')) {
            return $this->prepareResponse(
                $this->resolveNotFoundRoute(),
                Response::HTTP_NOT_FOUND
            );
        }

        foreach ($this->routes->getGroup($_SERVER['REQUEST_METHOD']) as $route) {
            // First we check if path matches any path
            // pattern or wordpress condition.
            if ($route->matches($wp->request, array_filter($wp_query->query_vars))) {
                // We find a match so return and break from the loop.
                return $this->prepareResponse($route->run());
            }
        }

        throw new RoutingException("Route not found. Couldn't find any matching route.");
    }
public function execute ( WP $ wp , WP_Query $ wp_query ) { // If error occurs, do not search for any route. // Immediately process to the `404` route. if ( $ this -> conditions -> is ( '404' ) ) { return $ this -> prepareResponse ( $ this -> resolveNotFoundRoute ( ) , Response :: HTTP_NOT_FOUND ) ; } foreach ( $ this -> routes -> getGroup ( $ _SERVER [ 'REQUEST_METHOD' ] ) as $ route ) { // First we check if path matches any path // pattern or wordpress condition. if ( $ route -> matches ( $ wp -> request , array_filter ( $ wp_query -> query_vars ) ) ) { // We find a match so return and break from the loop. return $ this -> prepareResponse ( $ route -> run ( ) ) ; } } throw new RoutingException ( "Route not found. Couldn't find any matching route." ) ; }
Execute router, match and resolve route.

@return mixed
Execute router match and resolve route .