145a874f4SNico<?php 245a874f4SNico 345a874f4SNiconamespace ComboStrap; 445a874f4SNico 545a874f4SNicoclass RouterRedirection 645a874f4SNico{ 745a874f4SNico 845a874f4SNico 945a874f4SNico /** 1045a874f4SNico * The combostrap canonical where the doc is 1145a874f4SNico */ 1245a874f4SNico public const PERMANENT_REDIRECT_CANONICAL = "permanent:redirect"; 1345a874f4SNico /** 1445a874f4SNico * For permanent, see https://developers.google.com/search/docs/advanced/crawling/301-redirects 1545a874f4SNico * was `Http` (301) 1645a874f4SNico */ 1745a874f4SNico public const REDIRECT_PERMANENT_METHOD = 'permanent'; 1845a874f4SNico /** 1945a874f4SNico * 404 (See other) (when best page name is calculated) 2045a874f4SNico */ 2145a874f4SNico public const REDIRECT_NOTFOUND_METHOD = "notfound"; 2245a874f4SNico 2345a874f4SNico /** 2445a874f4SNico * Transparent (Just setting another id without HTTP 3xx) 2545a874f4SNico */ 2645a874f4SNico const REDIRECT_TRANSPARENT_METHOD = 'transparent'; 2745a874f4SNico 2845a874f4SNico /** 2945a874f4SNico * Extended Permalink (abbreviated page id at the end) 3045a874f4SNico */ 3145a874f4SNico public const TARGET_ORIGIN_PERMALINK_EXTENDED = "extendedPermalink"; 3245a874f4SNico /** 3345a874f4SNico * Named Permalink (canonical) 3445a874f4SNico */ 3545a874f4SNico public const TARGET_ORIGIN_CANONICAL = 'canonical'; 3645a874f4SNico public const TARGET_ORIGIN_START_PAGE = 'startPage'; 3745a874f4SNico /** 3845a874f4SNico * Identifier Permalink (full page id) 3945a874f4SNico */ 4045a874f4SNico public const TARGET_ORIGIN_PERMALINK = "permalink"; 4145a874f4SNico public const TARGET_ORIGIN_SEARCH_ENGINE = 'searchEngine'; 4245a874f4SNico public const TARGET_ORIGIN_PAGE_RULES = 'pageRules'; 4345a874f4SNico public const TARGET_ORIGIN_ALIAS = 'alias'; 4445a874f4SNico public const TARGET_ORIGIN_BEST_END_PAGE_NAME = 'bestEndPageName'; 4545a874f4SNico public const TARGET_ORIGIN_BEST_PAGE_NAME = 'bestPageName'; 4645a874f4SNico public const TARGET_ORIGIN_BEST_NAMESPACE = 'bestNamespace'; 4745a874f4SNico public const TARGET_ORIGIN_WELL_KNOWN = 'well-known'; 4845a874f4SNico public const TARGET_ORIGIN_SHADOW_BANNED = "shadowBanned"; 4945a874f4SNico 5045a874f4SNico 51*313de40aSNicolas GERARD private RouterRedirectionBuilder $routerBuilder; 5245a874f4SNico 5345a874f4SNico public function __construct(RouterRedirectionBuilder $routerRedirectionBuilder) 5445a874f4SNico { 55*313de40aSNicolas GERARD $this->routerBuilder=$routerRedirectionBuilder; 5645a874f4SNico } 5745a874f4SNico 5845a874f4SNico public function getOrigin(): string 5945a874f4SNico { 60*313de40aSNicolas GERARD return $this->routerBuilder->getOrigin(); 6145a874f4SNico } 6245a874f4SNico 6345a874f4SNico public function getType(): string 6445a874f4SNico { 65*313de40aSNicolas GERARD return $this->routerBuilder->getType(); 6645a874f4SNico } 6745a874f4SNico 6845a874f4SNico public function getTargetAsString(): string 6945a874f4SNico { 7045a874f4SNico $markupPath = $this->getTargetMarkupPath(); 7145a874f4SNico if ($markupPath !== null){ 7245a874f4SNico return $markupPath->toAbsoluteId(); 7345a874f4SNico } 7445a874f4SNico 7545a874f4SNico $targetUrl = $this->getTargetUrl(); 7645a874f4SNico if($targetUrl!==null){ 7745a874f4SNico return $targetUrl->toAbsoluteUrlString(); 7845a874f4SNico } 7945a874f4SNico return ""; 8045a874f4SNico 8145a874f4SNico } 8245a874f4SNico 8345a874f4SNico public function getTargetUrl(): ?Web\Url 8445a874f4SNico { 85*313de40aSNicolas GERARD return $this->routerBuilder->getTargetUrl(); 8645a874f4SNico } 8745a874f4SNico 8845a874f4SNico public function getTargetMarkupPath(): ?MarkupPath 8945a874f4SNico { 90*313de40aSNicolas GERARD return $this->routerBuilder->getTargetMarkupPath(); 9145a874f4SNico } 9245a874f4SNico 9345a874f4SNico 9445a874f4SNico} 95