/**
  * Iterates through all configured routes and calls matches() on them.
  * Returns the matchResults of the matching route or NULL if no matching
  * route could be found.
  *
  * @param Request $httpRequest The web request to be analyzed. Will be modified by the router.
  * @return array The results of the matching route or NULL if no route matched
  */
 public function route(Request $httpRequest)
 {
     $cachedMatchResults = $this->routerCachingService->getCachedMatchResults($httpRequest);
     if ($cachedMatchResults !== FALSE) {
         return $cachedMatchResults;
     }
     $this->lastMatchedRoute = NULL;
     $this->createRoutesFromConfiguration();
     /** @var $route Route */
     foreach ($this->routes as $route) {
         if ($route->matches($httpRequest) === TRUE) {
             $this->lastMatchedRoute = $route;
             $matchResults = $route->getMatchResults();
             if ($matchResults !== NULL) {
                 $this->routerCachingService->storeMatchResults($httpRequest, $matchResults);
             }
             return $matchResults;
         }
     }
     return NULL;
 }
 /**
  * Iterates through all configured routes and calls matches() on them.
  * Returns the matchResults of the matching route or NULL if no matching
  * route could be found.
  *
  * @param Request $httpRequest The web request to be analyzed. Will be modified by the router.
  * @return array The results of the matching route or NULL if no route matched
  */
 public function route(Request $httpRequest)
 {
     $cachedMatchResults = $this->routerCachingService->getCachedMatchResults($httpRequest);
     if ($cachedMatchResults !== FALSE) {
         return $cachedMatchResults;
     }
     $this->lastMatchedRoute = NULL;
     $this->createRoutesFromConfiguration();
     /** @var $route Route */
     foreach ($this->routes as $route) {
         if ($route->matches($httpRequest) === TRUE) {
             $this->lastMatchedRoute = $route;
             $matchResults = $route->getMatchResults();
             if ($matchResults !== NULL) {
                 $this->routerCachingService->storeMatchResults($httpRequest, $matchResults);
             }
             $this->systemLogger->log(sprintf('Router route(): Route "%s" matched the path "%s".', $route->getName(), $httpRequest->getRelativePath()), LOG_DEBUG);
             return $matchResults;
         }
     }
     $this->systemLogger->log(sprintf('Router route(): No route matched the route path "%s".', $httpRequest->getRelativePath()), LOG_NOTICE);
     return NULL;
 }
 /**
  * @test
  */
 public function storeMatchResultsDoesNotStoreMatchResultsInCacheIfTheyContainObjects()
 {
     $matchResults = array('this' => array('contains' => array('objects', new \stdClass())));
     $this->mockRouteCache->expects($this->never())->method('set');
     $this->routerCachingService->storeMatchResults($this->mockHttpRequest, $matchResults);
 }