PluginProbe
Yatra – Travel Booking & Tour Operator Software / trunk
Yatra – Travel Booking & Tour Operator Software vtrunk
3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 2.0.11 All 82 releases
yatra / app / Sitemap / Integrations / AbstractIndexIntegration.php

AbstractIndexIntegration.php in Yatra – Travel Booking & Tour Operator Software trunk, at app/Sitemap/Integrations/AbstractIndexIntegration.php

44 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Yatra\Sitemap\Integrations;
6
7 use Yatra\Sitemap\SitemapRenderer;
8 use Yatra\Sitemap\SitemapRouter;
9 use Yatra\Sitemap\SitemapService;
10
11 /**
12 * Shared base for SEO plugins whose sitemap index is a filterable XML string
13 * (Yoast, Rank Math). We append a single <sitemap> node pointing at Yatra's
14 * own consolidated /yatra-sitemap.xml, so the plugin's index links to our one
15 * file without us re-implementing its rendering.
16 */
17 abstract class AbstractIndexIntegration
18 {
19 protected SitemapService $service;
20 protected SitemapRouter $router;
21 protected SitemapRenderer $renderer;
22
23 public function __construct(SitemapService $service, SitemapRouter $router, SitemapRenderer $renderer)
24 {
25 $this->service = $service;
26 $this->router = $router;
27 $this->renderer = $renderer;
28 }
29
30 abstract public function register(): void;
31
32 /**
33 * @param mixed $output Existing index XML (string).
34 */
35 public function append($output): string
36 {
37 $pointer = $this->renderer->indexEntries([
38 ['loc' => $this->router->sitemapUrl(), 'lastmod' => $this->service->getLatestLastmod()],
39 ]);
40
41 return (string) $output . $pointer;
42 }
43 }
44