Track the matched route.

@param  \Illuminate\Routing\Route  $route
@param  \Illuminate\Http\Request   $request
6115
public function trackMatchedRoute(Route $route, Request $request)
    {
        if ( ! $this->isEnabled()) return;

        $tracker = $this->getRouteTracker();

        if ($tracker->isTrackable($route)) {
            $this->mergeVisitorActivityData([
                'route_path_id' => $tracker->track($route, $request),
            ]);
        }
        else
            $this->disable();
    }
94999
protected function populateContent(Route $route, Request $request)
    {
        $content = $route->getContent();
        $name    = $content;

        if ($route->isList()) {
            $name .= 's';
            $value = $this->repository->getContents($content, $route->getIndexBy(), $route->getOrder());

            if ($route->isPaginated()) {
                $paginator = new Paginator($value, $route->getPerPage());
                $value     = $paginator->get($request->attributes->get('page'));
                $request->attributes->set('paginator', $paginator);
            }
        } else {
            $value = $this->repository->getContent($content, $request->attributes->get($content));
        }

        $request->attributes->set($name, $value);
    }
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);
	}
1287452
public function getMatchingRoute($request)
    {
        // Get matching route
        $this->currentRoute = $route = $this->routes->match($request);

        return $route;
    }
724425
public function run(Request $request) {
		$prefs = $this->getServiceContainer()->getPreferenceLoader()->getSystemPreferences();
		$routes = $this->generateRoutes();
		$response = new Response();
		$context = new RequestContext($prefs->getAccountUrl());
		$matcher = new UrlMatcher($routes, $context);
		$payload = [];

		$match = $matcher->match($this->getDestination());
		$route = $match['_route'];
		$module = $this->getModule();
		$auth = $this->getServiceContainer()->getAuthManager();
		$action = null;

		switch ($route) {
			case 'index':
				if ($auth->isRecognized()) {
					$action = $module->loadAction('dashboard', 'html');
				} else {
					$action = $module->loadAction('index', 'html');
				}
				break;

			case 'register':
				$action = $module->loadAction('register', 'html');
				break;

			case 'forgot-password':
			case 'forgot-password-token':
				$action = $module->loadAction('forgot-password', 'html');
				$action->setParams([
					'token' => isset($match['token']) ? $match['token'] : null
				]);
				break;

			case 'login':
				$action = $module->loadAction('login', 'html');
				break;

			case 'activity':
				$action = $module->loadAction('activity', 'html');
				break;

			case 'settings':
				$action = $module->loadAction('settings', 'html');
				$action->setParams([
					'section' => $match['section']
				]);
				break;

			case 'logout':
				$action = $module->loadAction('logout');
				break;
		}

		$kernel = $this->getServiceContainer()->getKernel();
		$response = $kernel->handle($action, $request);

		if ($response instanceof RedirectResponse) {
			return $response;
		}

		$payload = [
			'main' => $response->getContent(),
		];

		return $this->responder->run($request, new Blank($payload));
	}
108024
public function handle(RouteMatched $event)
    {
        $this->tracker->trackMatchedRoute($event->route, $event->request);
    }
577520
public function matchRequest(Request $request) {
        $context = new RequestContext();
        $context->fromRequest($request);
        $this->setContext($context);

        return($this->match($request->getPathInfo()));
    }
165824
public function match(Request $request)
    {
        try {
            return parent::match($request);
        } catch (NotFoundHttpException $e) {
            $route = $this->findMatchingWordpressPost();

            if ( ! is_null($route)) {
                return $route->bind($request);
            }

            throw $e;
        }
    }
35887
protected function callFilter($filter, $route, $request)
	{
		extract($filter);

		return $this->filterer->callRouteFilter($filter, $parameters, $route, $request);
	}
1369769
private static function routeMatch(string $request_url, string $request_method, Route $route) :bool {

		// if the method is set for that route, and it doesn't match
		if(!$route->hasMethod($request_method)) {
			return false;
		}
		// if the url doesn't begin with the static segment or that route
		if(!$route->hasStaticUrlSegment($request_url)) {
			return false;
		}
		// if we've got a redirect, let's go for it
		$route->redirectIfItIsOne();
		// get a list of current request parameters, with numerical indexes
		$indexed_request_parameters = Request::getUrlIndexedParameters($route->staticSegment);
		// if restricttion against url parameters don't match
		if(!$route->validatesTheseParameters($indexed_request_parameters)) {
			return false;
		}
		// send the named parameters to the request class
		$route->sendNamedParametersToRequest($indexed_request_parameters);
		// deduce the dynamic action from the url parameters if necessary
		$route->deduceAction();
		// check if they match defined constraints
		return true;

	}
7705
protected function callAttachedBefores($route, $request)
	{
		foreach ($route->beforeFilters() as $filter => $parameters)
		{
			$response = $this->callRouteFilter($filter, $parameters, $route, $request);

			if ( ! is_null($response)) return $response;
		}
	}
121834
final public function run(Request $request)
    {
        $this->request = $request;
        $path = $this->request->getUri()->getPath();
        $this->requestedUri = ($path != "/") ? rtrim($path, "/") : "/";
        $this->requestedMethod = strtoupper($this->request->getMethod());
        $this->requestedRepresentation = $this->request->getAccept();
        $this->verifyRequestMethod();
        $route = $this->findRouteFromRequest();
        $this->prepareResponse($route);
    }
209259
public function matches(Route $route, Request $request)
	{
		if (is_null($route->getCompiled()->getHostRegex())) return true;

		return preg_match($route->getCompiled()->getHostRegex(), $request->getHost());
	}
10811
private function trackRoute(Route $route)
    {
        return $this->getModel()->newQuery()->firstOrCreate([
            'name'   => $this->getRouteName($route),
            'action' => $route->getActionName(),
        ])->getKey();
    }
1236759
public function getMatchingRoute($routes, Request $request)
    {
        foreach ($routes as $matchingRoute) {
            if ($matchingRoute->matches($request)) {
                return $matchingRoute;
            }
        }

        return null;
    }
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);
    }
431439
public function handle(Request $request)
	{
		if (!$this->app->runningInConsole())
		{
			$this->app['dispatcher']->trigger('system.onBeforeRoute');

			foreach ($this->app['router']->parse($request->getUri()) as $key => $val)
			{
				$request->setVar($key, $val, 'get');
			}

			$this->app['dispatcher']->trigger('system.onAfterRoute');

			if ($this->app->has('profiler'))
			{
				$this->app['profiler'] ? $this->app['profiler']->mark('afterRoute') : null;
			}
		}

		return $this->next($request);
	}