cleanup() public method

Removes all replacers.
public cleanup ( string $url, array $replacers = null ) : string
$url string
$replacers array
return string
示例#1
0
文件: Generator.php 项目: sulu/sulu
 /**
  * Localize given domain.
  *
  * @param string $domain
  * @param Localization $locale
  *
  * @return string
  */
 protected function localizeDomain($domain, Localization $locale)
 {
     if (!$this->urlReplacer->hasLocalizationReplacer($domain) && !$this->urlReplacer->hasLanguageReplacer($domain)) {
         $domain = $this->urlReplacer->appendLocalizationReplacer($domain);
     }
     $domain = $this->urlReplacer->replaceLanguage($domain, $locale->getLanguage());
     $domain = $this->urlReplacer->replaceCountry($domain, $locale->getCountry());
     $domain = $this->urlReplacer->replaceLocalization($domain, $locale->getLocalization());
     return $this->urlReplacer->cleanup($domain);
 }
示例#2
0
 /**
  * @param Portal $portal
  * @param Environment $environment
  * @param string $urlAddress
  * @param string $urlAnalyticsKey
  * @param Url $url
  */
 private function buildUrlPartialMatch(Portal $portal, Environment $environment, $urlAddress, $urlAnalyticsKey, Url $url)
 {
     $replacers = [];
     $defaultSegment = $portal->getWebspace()->getDefaultSegment();
     if ($defaultSegment) {
         $replacers[ReplacerInterface::REPLACER_SEGMENT] = $defaultSegment->getKey();
     }
     $urlResult = $this->urlReplacer->cleanup($urlAddress, [ReplacerInterface::REPLACER_LANGUAGE, ReplacerInterface::REPLACER_COUNTRY, ReplacerInterface::REPLACER_LOCALIZATION, ReplacerInterface::REPLACER_SEGMENT]);
     $urlRedirect = $this->generateUrlAddress($urlAddress, $replacers);
     if ($this->validateUrlPartialMatch($urlResult, $environment)) {
         $this->portalInformations[$environment->getType()][$urlResult] = new PortalInformation(RequestAnalyzerInterface::MATCH_TYPE_PARTIAL, $portal->getWebspace(), $portal, null, $urlResult, $portal->getWebspace()->getDefaultSegment(), $urlRedirect, $urlAnalyticsKey, false, $url->getUrl(), $this->urlReplacer->hasHostReplacer($urlResult) ? 4 : 9);
     }
 }