service = $service; $this->router = $router; } public function register(): void { add_filter('aioseo_sitemap_indexes', [$this, 'addIndex']); } /** * @param mixed $indexes * @return array> */ public function addIndex($indexes): array { $indexes = is_array($indexes) ? $indexes : []; $indexes[] = [ 'loc' => $this->router->sitemapUrl(), 'lastmod' => $this->service->getLatestLastmod() ?: gmdate('Y-m-d\TH:i:s+00:00'), 'count' => $this->service->getCount(), ]; return $indexes; } }