module; if (!$sitemapData = $module->cacheProvider->get($module->cacheKey)) { $sitemapData = $module->buildSitemap(); } Yii::$app->response->format = Response::FORMAT_RAW; $headers = Yii::$app->response->headers; $headers->add('Content-Type', 'application/xml'); if ($module->enableGzip) { if (!$module->enableGzipedCache) { $sitemapData = gzencode($sitemapData); } $headers->add('Content-Encoding', 'gzip'); $headers->add('Content-Length', strlen($sitemapData)); } elseif ($module->enableGzipedCache) { $sitemapData = gzdecode($sitemapData); } return $sitemapData; } }