• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 8218b111533b92ec47f94130a94bcd0102263a45

01 Dec 2025 09:48AM UTC coverage: 53.092%. First build
8218b111533b92ec47f94130a94bcd0102263a45

push

github

web-flow
Merge pull request #22759 from Yoast/feature/task-list

Feature/task list

8697 of 16050 branches covered (54.19%)

Branch coverage included in aggregate %.

98 of 605 new or added lines in 51 files covered. (16.2%)

32413 of 61381 relevant lines covered (52.81%)

46976.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/task-list/application/tasks/enable-llms-txt.php
1
<?php
2
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
3
namespace Yoast\WP\SEO\Task_List\Application\Tasks;
4

5
use Yoast\WP\SEO\Helpers\Options_Helper;
6
use Yoast\WP\SEO\Task_List\Domain\Components\Call_To_Action_Entry;
7
use Yoast\WP\SEO\Task_List\Domain\Components\Copy_Set;
8
use Yoast\WP\SEO\Task_List\Domain\Exceptions\Complete_LLMS_Task_Exception;
9
use Yoast\WP\SEO\Task_List\Domain\Tasks\Abstract_Completeable_Task;
10

11
/**
12
 * Represents the task for the enabling the llms.txt file.
13
 */
14
class Enable_Llms_Txt extends Abstract_Completeable_Task {
15

16
        /**
17
         * Holds the id.
18
         *
19
         * @var string
20
         */
21
        protected $id = 'enable-llms-txt';
22

23
        /**
24
         * Holds the priority.
25
         *
26
         * @var string
27
         */
28
        protected $priority = 'medium';
29

30
        /**
31
         * Holds the duration.
32
         *
33
         * @var int
34
         */
35
        protected $duration = 1;
36

37
        /**
38
         * Holds the options helper.
39
         *
40
         * @var Options_Helper
41
         */
42
        private $options_helper;
43

44
        /**
45
         * Constructs the task.
46
         *
47
         * @param Options_Helper $options_helper The options helper.
48
         */
NEW
49
        public function __construct( Options_Helper $options_helper ) {
×
NEW
50
                $this->options_helper = $options_helper;
×
51
        }
52

53
        /**
54
         * Returns whether this task is completed.
55
         *
56
         * @return bool Whether this task is completed.
57
         */
NEW
58
        public function get_is_completed(): bool {
×
NEW
59
                return $this->options_helper->get( 'enable_llms_txt', false );
×
60
        }
61

62
        /**
63
         * Returns the task's link.
64
         *
65
         * @return string|null
66
         */
NEW
67
        public function get_link(): ?string {
×
NEW
68
                return null;
×
69
        }
70

71
        /**
72
         * Completes a task.
73
         *
74
         * @return void
75
         *
76
         * @throws Complete_LLMS_Task_Exception If the option could not be set.
77
         */
NEW
78
        public function complete_task(): void {
×
NEW
79
                $result = $this->options_helper->set( 'enable_llms_txt', true );
×
80

NEW
81
                if ( ! $result ) {
×
NEW
82
                        throw new Complete_LLMS_Task_Exception();
×
83
                }
84
        }
85

86
        /**
87
         * Returns the task's call to action entry.
88
         *
89
         * @return string|null
90
         */
NEW
91
        public function get_call_to_action(): Call_To_Action_Entry {
×
NEW
92
                return new Call_To_Action_Entry(
×
NEW
93
                        \__( 'Enable llms.txt', 'wordpress-seo' ),
×
NEW
94
                        'default',
×
NEW
95
                        $this->get_link()
×
NEW
96
                );
×
97
        }
98

99
        /**
100
         * Returns the task's copy set.
101
         *
102
         * @return string|null
103
         */
NEW
104
        public function get_copy_set(): Copy_Set {
×
NEW
105
                return new Copy_Set(
×
NEW
106
                        \__( 'Create an llms.txt file', 'wordpress-seo' ),
×
NEW
107
                        \__( 'Without llms.txt, AI crawlers may not know how to treat your content. Publishing it helps communicate your preferences in a clearer way to AI tools.', 'wordpress-seo' )
×
NEW
108
                );
×
109
        }
110
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc