$shop =
$this->
get('shop'
);
$routerContexts =
$this->
getRouterContext($shop->
getMain() ?:
$shop);
$baseUrls =
array_map(static function DContext
$context) { return $context->
getBaseUrl();
},
$routerContexts);
$robotsTxtGenerator =
$this->
get(RobotsTxtGeneratorInterface::
class);
$baseUrls =
array_unique($baseUrls);
$robotsTxtGenerator->
setRouterContext($routerContexts);
$robotsTxtGenerator->
setBaseUrls($baseUrls);
$robotsTxtGenerator->
setHost($shop->
getHost());
$robotsTxtGenerator->
setSecure($shop->
getSecure());
$this->
View()->
assign('robotsTxt',
$robotsTxtGenerator);
$this->
Response()->headers->
set('content-type', 'text/plain; charset=utf-8'
);
} /**
* @return array<int, Context>
*/
private function getRouterContext(Shop
$mainShop): array
{