@param Route $route

@throws SwaggerException
359007
private function autoDetectEntity(Route $route)
    {
        if ($route->entity) {
            $entityReflection = new \ReflectionClass($route->entity);
            $route->entity_name = $entityReflection->getShortName();
        } else {
            // if we have not been given an entity, try and find an entity of the same name...
            $namespaceParts = explode('\\', $route->controller);
            $entityName = str_replace('Controller', '', array_pop($namespaceParts));
            while (count($namespaceParts)) {
                $endPart = array_pop($namespaceParts);
                if ($endPart == 'Controller') {
                    break;
                }
            }

            $guessEntityClass = implode('\\', $namespaceParts).'\\Entity\\'.$entityName;

            if (class_exists($guessEntityClass)) {
                $route->entity = $guessEntityClass;
                $route->entity_name = $entityName;
            } else {
                throw new SwaggerException(
                    'Entity for route "'.$route->route.'" was not defined and could not be guessed'
                );
            }
        }
    }
460049
protected function dispatchRoute(\Parable\Routing\Route $route)
    {
        $this->response->setHttpCode(200);
        $this->hook->trigger(self::HOOK_HTTP_200, $route);

        $dispatcher = \Parable\DI\Container::get(\Parable\Framework\Dispatcher::class);
        $dispatcher->dispatch($route);

        return $this;
    }
270689
public function callRouteBefore($route, $request)
	{
		$response = $this->callPatternFilters($route, $request);

		return $response ?: $this->callAttachedBefores($route, $request);
	}
750027
private function getOperations(Swagger $api, Route $route): array
    {
        $operations = [];
        $path = $api->getPaths()->get($this->normalizePath($route->getPath()));
        $methods = $route->getMethods() ?: Swagger::$METHODS;
        foreach ($methods as $method) {
            $method = strtolower($method);
            if (!in_array($method, Swagger::$METHODS)) {
                continue;
            }

            $operations[] = $path->getOperation($method);
        }

        return $operations;
    }
832688
private function dispatch($request, $route)
    {
        if ($route->matched()) {
            $request = $request->withPathToMatch($route->matched(), $route->trailing());
        }
        // dispatch the route!
        return $this->dispatcher->withRoute($route)->__invoke($request);
    }
1131359
public static function performRoute($route) {
		$api_mode = isset($route["api-mode"]);
		Request::setRequestVariables($route["variables"], $api_mode);

		$controller = new $route["class"];
		$response = $controller->$route["method"]();

		if(!Request::isAjax() && !Request::isAPI() && isset($route["render-path"])) {
			Request::setRenderPath($route["render-path"]);
			try {
				$route = self::findRoute(explode('/', $route["render-path"]));
			} catch(ValidRouteNotFoundException $e) {
				throw new ValidRenderRouteNotFoundException($e);
			}
			$response = self::performRoute($route);
		}

		return $response;
	}
581440
protected function dispatchRoute(Route $route, array $params)
    {
        if ($route->beforeDispatch !== "") {
            $result = $this->hooks->exec($route->beforeDispatch, $route);
        } else {
            $result = $this->hooks->exec("router.dispatcher.beforeDispatch", $route);
        }

        // check hook results permit route execution
        if (($result === false
            || (is_array($result) && in_array(false, $result))) === false) {
            $this->logger->info(
                "Executing route definition",
                ["name" => $route->uri, "action" => $route->action]
            );
            ($route->action)(...$params);
        }
    }
749322
public function dispatch(Route $route)
    {
        $callback = $route->getCallback();
        $params = array_values($route->getData());

        if ($callback instanceof Closure) {
            return $this->container->resolveClosure($callback, $params);
        }

        $class = $this->container->make($callback[0]);
        return $this->container->resolveMethod($class, $callback[1], $params);
    }
773422
private function extractFunctionFromRoute(Route $route)
    {
        $controller = explode('::', $this->extractControllerDefaultFromRoute($route));

        return isset($controller[1]) ? $controller[1] : null;
    }
306278
public function add(Route $route)
    {
        foreach ($route->getMethods() as $method) {
            $this->routes[$method][$route->getPath()] = $route;

            $this->allRoutes[$route->getPath()] = $route;
        }

        return $route;
    }
1244354
protected function dispatchMethod($request, $route)
    {
        list($path, $var) = $this->parseUrlPath($route);

        $route = str_replace('/', '@', implode('/', $path));
        $method = strpos($route, '@') ? explode('@', $route) : $route;

        return new CallbackDispatch($request, $this, $method, $var);
    }
174132
private function validateRoute($route) {
        if (!$route instanceof Route) {
            throw new \Exception('A type of Route or a derivative is expected.');
        }
        
        if ($route->ignore !== true && empty($route->name)) {
            throw new \Exception('The name of the route is expected. The value must not be empty.');
        }

        if ($route->ignore !== true && !$this->isUniqueRouteName($route->name)) {
            throw new \Exception('The name "' . $route->name . '" is already used for another route. Specify a unique name.');
        }

        if (empty($route->template)) {
            throw new \Exception('The route "' . $route->name . '" does not specify a template. Please specify a template.');
        }
    }
620009
public function toRoute($route)
	{
		if ($this->caller != null)
			$this->disableRender[] = $this->caller->identifier;
		$r = $this->router->getRoute($route);
		if ($r != null) {
			$this->currentRoute = $r;
			try {
				$this->execute();
			} catch (\Exception $e) {
				Logger::Log('log/error.txt', $e->getMessage());
				\decoy\base\ErrorController::$errors[] = $e->getMessage();
				$this->toRoute('error_page');
			}
		}
		$this->caller = null;
	}
621957
public function track(Route $route, Request $request)
    {
        return $this->trackRoutePath(
            $route, $request, $this->trackRoute($route)
        );
    }
1342711
public function add(Route $route): self
    {
        if ($route->uri === ""
            || $route->method === 0b0
            || $route->action === null) {
            $this->logger->error("Route incomplete. Unable to add");
            $this->logger->debug("Incomplete Route", [$route]);
            throw new Exception\RouteIncompleteException(
                "Retrieved Route is not complete and can not be stored"
            );
        }

        // store default route
        if ($route->isDefault) {
            if ($this->defaultRoute === null) {
                $this->defaultRoute = $route;
            } else {
                $this->logger->debug(
                    "Default route already added to container, skipping add.",
                    ["route" => $route, "storedDefault" => $this->defaultRoute]
                );
            }
        }

        // store 404 route
        if ($route->is404) {
            if ($this->e404Route === null) {
                $this->e404Route = $route;
                $this->logger->info("404 route added to Route Container");
            } else {
                $this->logger->debug(
                    "404 route already added to container, skipping add.",
                    ["route" => $route, "stored404" => $this->e404Route]
                );
            }

            return $this;
        }

        // store route to regular container
        $this->routes[] = $route;

        $this->logger->info(
            "Route successfully added to Container",
            ["uri" => $route->uri]
        );

        return $this;
    }
521889
public function route(Route $route, $handler) 
	{
		if (!is_callable($handler)) {
			throw new Exception('Route handler must be callable.');
		}

		$this->currentContext->addRoute($route, $handler);
		return $this;
	}
908289
public function find(Request $request, array $routes)
    {
        foreach ($routes as $route) {

            if(!$this->matchMethod($request, $route)){
                continue;
            }

            if(!$this->matchContentType($request, $route)){
                continue;
            }

            if(!$this->matchFilters($route)){
                continue;
            }

            $routeMatches = $this->matchPattern($request, $route);
            if ($routeMatches) {
                $route->setMatches($routeMatches);
                return $route;
            }
        }
        throw new RouteException(
            sprintf('No route found for uri "%s"', $request->getRequestUri()),
            $request,
            $routes
        );
    }