Will try to match parameters and execute the callback.
Will also trigger middleware.

@param Route $route

@param string $method Method of request.

@param bool $force true for skipping middleware. Could be bad to do!
506967
private function executeRoute(Route &$route, $method, $force = false)
    {
        $continue = true;
        if (! $force) {
            $continue = $this->executeRouteMiddleware($route, 'before', $method);
        }

        if ($continue === true) {
            $route->execute($this->compiled);
        }

        if (! $force) {
            $this->executeRouteMiddleware($route, 'after', $method);
        }
    }
227583
protected function performBinding($key, $value, $route)
    {
        $callback = $this->binders[$key];

        return call_user_func($callback, $value, $route);
    }
516781
public function dispatch(\Parable\Routing\Route $route)
    {
        $this->dispatchedRoute = $route;

        $this->hook->trigger(self::HOOK_DISPATCH_BEFORE, $route);
        $controller = null;

        // Start output buffering and set $returnContent to null
        $returnContent = null;
        $this->response->startOutputBuffer();

        // Build the parameters array
        $parameters = [];
        foreach ($route->getValues() as $value) {
            $parameters[] = $value;
        }

        // Call the relevant code
        if ($route->hasControllerAndAction()) {
            $controller = \Parable\DI\Container::get($route->getController());
            $returnContent = $controller->{$route->getAction()}(...$parameters);
        } elseif ($route->hasCallable()) {
            $callable = $route->getCallable();
            $returnContent = $callable(...$parameters);
        }

        $this->hook->trigger(self::HOOK_DISPATCH_TEMPLATE_BEFORE, $route);

        // If the route has no template path, attempt to build one based on controller/action.phtml
        if (!$route->hasTemplatePath() && $route->hasControllerAndAction()) {
            $reflection = new \ReflectionClass($controller);
            $controllerName = str_replace('\\', '/', $reflection->getName());
            $controllerName = str_replace('Controller/', '', $controllerName);

            $templatePathGenerated = $this->path->getDir(
                "app/View/{$controllerName}/{$route->getAction()}.phtml"
            );

            if (file_exists($templatePathGenerated)) {
                $route->setTemplatePath($templatePathGenerated);
            }
        }

        // And check again, now that we might have a magic template path
        if ($route->hasTemplatePath()) {
            $templatePath = $this->path->getDir($route->getTemplatePath());
            $this->view->setTemplatePath($templatePath);
            $this->view->render();
        }

        // If the callback or controller/action returned content, we need to handle it
        if ($returnContent) {
            if ($this->response->getOutput()->acceptsContent($returnContent)) {
                $this->response->setContent($returnContent);
            } else {
                $type   = gettype($returnContent);
                $output = get_class($this->response->getOutput());

                // Stop the output buffer we've started above and throw
                $this->response->stopOutputBuffer();
                throw new \Parable\Framework\Exception(
                    "Route returned value of type '{$type}', which output class '{$output}' cannot handle."
                );
            }
        }

        // Any rendered content was from before the returnContent was set, so we prepend it if there's any
        $renderedContent = $this->response->returnOutputBuffer();
        if ($renderedContent) {
            $this->response->prependContent($renderedContent);
        }

        $this->hook->trigger(self::HOOK_DISPATCH_TEMPLATE_AFTER, $route);
        $this->hook->trigger(self::HOOK_DISPATCH_AFTER, $route);
        return $this;
    }
1042008
protected function  handleFoundRoute($route, Request $request)
    {
        $this->currentRoute = $route;
        $request->attributes->add($route[2]);

        if (isset($route[1]['middleware']) && !empty($route[1]['middleware'])) {
            $middleware = $route[1]['middleware'];
            $middleware = is_string($middleware) ? explode('|', $middleware) : (array) $middleware;
            $middleware = array_map(function ($m) { return $this->middlewareNamespace .'\\'. $m; }, $middleware);

            $response = (new Pipeline())->send($request)->through($middleware)
                ->then(function () use ($route, $request) {
                    return $this->callAction($route, $request);
                });
        }
        else {
            $response = $this->callAction($route, $request);
        }

        if (!$response instanceof Response) {
            $response = new Response($response);
        }

        return $response;
    }
478129
public static function verify($route, $path, $method=null)
    {
        /*
         * check method comparison, if method is specified.
         */
        $routeMethod = $method;
        if (strpos($route, ':') !== false && substr($route, 0, 1) !== '/' ) {
            list($routeMethod, $route) = explode( ':', $route, 2 );
            $routeMethod = strtolower($routeMethod);
            if ($method === '*') {
                // no matching against method!
            }
            elseif (strcmp(strtolower($method), $routeMethod)) {
                return [];
            }
        }
        $route = '/'.ltrim($route, '/');
        $path  = '/'.ltrim($path, '/');
        /*
         * now verify route against the path.
         */
        // replace {name} => (?P<name>[-_0-9a-zA-Z]+)
        $route = preg_replace_callback(
            '/{([_:*0-9a-zA-Z]+)}/',
            [self::class,'identifier'],
            $route
        );
        if(substr($route, -1) === '*') {
            $route  = substr($route, 0, -1 ) . '(.*)';
        }
        // now match the route against the path.
        if (preg_match('#^'.$route.'$#', $path, $matches)) {
            if(isset($matches['trailing'])) { // with *
                if(!$matches['trailing']) {
                    $matches['matched'] = $matches[0];
                } else {
                    $matches['matched'] = substr($path, 0, -strlen($matches['trailing']));
                }
            }
            $matches['method'] = $routeMethod;
            return $matches;
        }
        return [];
    }
559258
public function execute(Request $request, Route $route, $parameters)
    {
        $request->attributes->set('_controller', $this->getControllerCallback());
        $app = Facade::getFacadeApplication();
        $controllerResolver = $app->make(ApplicationAwareControllerResolver::class);
        $callback = $controllerResolver->getController($request);
        $argumentsResolver = $app->make(ArgumentResolver::class);

        $arguments = $argumentsResolver->getArguments($request, $callback);
        $controller = $callback[0];
        $method = $callback[1];

        if (method_exists($controller, 'on_start')) {
            $controller->on_start();
        }

        if (method_exists($controller, 'runAction')) {
            $response = $controller->runAction($method, $arguments);
        } else {
            $response = call_user_func_array([$controller, $method], $arguments);
        }

        if ($response instanceof Response) {
            // note, our RedirectResponse doesn't extend Response, it extends symfony2 response
            return $response;
        }

        if ($response instanceof AbstractView) {
            $content = $response->render();
        } else if (method_exists($controller, 'getViewObject')) {
            $content = null;
            $view = $controller->getViewObject();
            if (is_object($view)) {
                $view->setController($controller);
                if (isset($view) && $view instanceof AbstractView) {
                    $content = $view->render();
                }
            }
        } else {
            $content = $response;
        }

        if (is_object($content)) {
            return $content;
        }

        $response = new Response();
        $response->setContent($content);
        return $response;
    }
174505
protected function runRoute(Request $request, Route $route)
    {
        $request->setRouteResolver(function () use ($route) {
            return $route;
        });

        $this->events->dispatch(new Events\RouteMatched($route, $request));

        return $this->prepareResponse($request,
            $this->runRouteWithinStack($route, $request)
        );
    }
1234339
public function addRoute(string $method, string $route, ...$callback)
    {
        $method = strtolower($method);
        $route = ltrim($route, '/');
        $group = rtrim($this->group, '/') . '/';
        $route = $group . $route;
        $scope = $this->middleware->count();
        $this->layer[$method][] = new Route(
            $method,
            $route,
            $callback,
            $scope,
            $this->group
        );

        return true;
    }
35887
protected function callFilter($filter, $route, $request)
	{
		extract($filter);

		return $this->filterer->callRouteFilter($filter, $parameters, $route, $request);
	}
1017855
protected function callLumenControllerWithMiddleware($instance, $method, $routeInfo, $middleware)
    {
        $middleware = $this->gatherMiddlewareClassNames($middleware);

        return $this->sendThroughPipeline($middleware, function () use ($instance, $method, $routeInfo) {
            return $this->callControllerCallable([$instance, $method], $routeInfo[2]);
        });
    }
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;
	}
1179199
public function processRequest(Request $request, Route $route)
    {
        $givenToken = $request->headers->get(self::HEADER);

        $session = $request->getSession();
        $expectedToken = $session->get(self::CSRF);
        if ($request->isMethod('GET') && (!$route->hasOption(self::CSRF)) || $route->hasDefault('_guest')) {
            if (empty($expectedToken)) {
                $this->renewCsrfToken();
            }
            return;
        }

        if (empty($givenToken) || $givenToken !== $expectedToken) {
            throw new MethodNotAllowedException(['POST'], 'invalid CSRF token');
        }

        $this->generateNewTokenWhenNeeded($session);
    }
1323631
public static function process(\Request $request, $route = true)
	{
		$match = false;

		if ($route)
		{
			foreach (static::$routes as $route)
			{
				if ($match = $route->parse($request))
				{
					break;
				}
			}
		}

		if ( ! $match)
		{
			// Since we didn't find a match, we will create a new route.
			$match = new Route(preg_quote($request->uri->get(), '#'), $request->uri->get());
			$match->parse($request);
		}

		if ($match->callable !== null)
		{
			return $match;
		}

		return static::parse_match($match);
	}
361756
public function map($method, $route, $action)
    {
        return $this->getRouter()->map($method, $route, $this->bindClosureToInstance($action, $this));
    }
79558
public function routeMatched(ApiRoute $route, Request $request): void
	{
		if (($format = $request->getParameter(self::API_DOCU_STARTER_QUERY_KEY_GENERATE)) !== null) {
			$this->generator->generateAll($this->router);

			exit(0);
		}

		if (($format = $request->getParameter(self::API_DOCU_STARTER_QUERY_KEY_TARGET)) !== null) {
			$this->generator->generateTarget($route, $request);

			exit(0);
		}
	}
181611
protected function handleRouteCallback(Route $route, RouteCollection $matched, array $methods_matched)
    {
        // Handle the callback
        $returned = call_user_func(
            $route->getCallback(), // Instead of relying on the slower "invoke" magic
            $this->request,
            $this->response,
            $this->service,
            $this->app,
            $this, // Pass the Klein instance
            $matched,
            $methods_matched
        );

        if ($returned instanceof AbstractResponse) {
            $this->response = $returned;
        } else {
            // Otherwise, attempt to append the returned data
            try {
                $this->response->append($returned);
            } catch (LockedResponseException $e) {
                // Do nothing, since this is an automated behavior
            }
        }
    }
823394
protected function runRouteWithinStack(Route $route, Request $request)
    {
        $skipMiddleware = $this->container->bound('middleware.disable') &&
                          ($this->container->make('middleware.disable') === true);

        // Create a Pipeline instance.
        $pipeline = new Pipeline(
            $this->container, $skipMiddleware ? array() : $this->gatherRouteMiddleware($route)
        );

        return $pipeline->handle($request, function ($request) use ($route)
        {
            $response = $route->run($request);

            return $this->prepareResponse($request, $response);
        });
    }