public function getRedirectUrl()
 {
     $redirectUrl = $this->map->getUrlTo();
     if (!$this->isAbsoluteUrl($redirectUrl) && ($baseUrl = $this->request->getBaseUrl())) {
         $redirectUrl = $baseUrl . $redirectUrl;
     }
     $redirectUrl = $this->applyReplacements($redirectUrl);
     return $redirectUrl;
 }
 /**
  * Check for circular redirects etc
  * @param Map $map
  * @return boolean
  */
 public function validate(Map $map)
 {
     if ($map->getUrlFrom() == $map->getUrlTo()) {
         return false;
     }
     $self = $this;
     $accumulator = [];
     if ($map->getId()) {
         $accumulator = [$map->getId() => $map->getId()];
     }
     $recurse = function (Map $map, Map $startPointMap) use($self, &$recurse, &$accumulator) {
         $matchingToUrls = $self->mapRepository->findForUrlOrPath($map->getUrlTo(), $map->getUrlTo(), $accumulator);
         foreach ($matchingToUrls as $match) {
             $accumulator[$match->getId()] = $match->getId();
             if ($startPointMap->getUrlFrom() == $match->getUrlTo()) {
                 return false;
             } elseif ($match->getUrlFrom() == $map->getUrlTo()) {
                 return $recurse($match, $startPointMap);
             }
         }
         return true;
     };
     return $recurse($map, $map);
 }