handlers = $handlers; } public function getTypes(): array { $types = []; foreach ($this->handlers as $handler) { if ($handler::isAllowed()) { $types[] = $handler::getType(); } } return $types; } public function getSitemap(string $type): SitemapInterface { foreach ($this->handlers as $handler) { if ($handler::getType() === $type && $handler::isAllowed()) { return $handler; } } throw new UnknownSitemapTypeException($type); } }