public function getRoute(Request $request): Route
    {
        if ($this->configuration->isRestRouting()) {
            $route = RestRouter::getInstance($this->configuration, $request)->resolveRoute();

            if ($route instanceof Route) {
                return $route;
            }
        }

        $query = $request->query->get('route');
        $this->routeParams = explode('/', trim($query, '/'));

        $route = (new Route())
            ->setController($this->resolveController())
            ->setAction($this->resolveAction())
            ->setActionParams($this->resolveActionParams());

        return $route;
    }