PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.2
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.2
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / llms-txt / application / markdown-builders / optional-link-list-builder.php

optional-link-list-builder.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.2, at src/llms-txt/application/markdown-builders/optional-link-list-builder.php

46 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
4 namespace Yoast\WP\SEO\Llms_Txt\Application\Markdown_Builders;
5
6 use Yoast\WP\SEO\Llms_Txt\Domain\Markdown\Sections\Link_List;
7 use Yoast\WP\SEO\Llms_Txt\Infrastructure\Markdown_Services\Sitemap_Link_Collector;
8
9 /**
10 * The builder of the intro section.
11 */
12 class Optional_Link_List_Builder {
13
14 /**
15 * The sitemap link collector.
16 *
17 * @var Sitemap_Link_Collector
18 */
19 private $sitemap_link_collector;
20
21 /**
22 * The constructor.
23 *
24 * @param Sitemap_Link_Collector $sitemap_link_collector The sitemap link collector.
25 */
26 public function __construct(
27 Sitemap_Link_Collector $sitemap_link_collector
28 ) {
29 $this->sitemap_link_collector = $sitemap_link_collector;
30 }
31
32 /**
33 * Builds the optional link list.
34 *
35 * @return Link_List The optional link list.
36 */
37 public function build_optional_link_list(): Link_List {
38 $sitemap_link = $this->sitemap_link_collector->get_link();
39 if ( $sitemap_link === null ) {
40 return new Link_List( 'Optional', [] );
41 }
42
43 return new Link_List( 'Optional', [ $sitemap_link ] );
44 }
45 }
46