PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
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 / configuration / llms-txt-configuration.php

llms-txt-configuration.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI trunk, at src/llms-txt/application/configuration/llms-txt-configuration.php

72 lines 1.8 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\Configuration;
5
6 use Yoast\WP\SEO\Helpers\Options_Helper;
7 use Yoast\WP\SEO\Helpers\Post_Type_Helper;
8 use Yoast\WP\SEO\Llms_Txt\Application\Health_Check\File_Runner;
9
10 /**
11 * Responsible for the llms.txt configuration.
12 */
13 class Llms_Txt_Configuration {
14
15 /**
16 * Runs the health check.
17 *
18 * @var File_Runner
19 */
20 private $runner;
21
22 /**
23 * The post type helper.
24 *
25 * @var Post_Type_Helper
26 */
27 private $post_type_helper;
28
29 /**
30 * The options helper.
31 *
32 * @var Options_Helper
33 */
34 private $options_helper;
35
36 /**
37 * The constructor.
38 *
39 * @param File_Runner $runner The File_Generation health check runner.
40 * @param Post_Type_Helper $post_type_helper The post type helper.
41 * @param Options_Helper $options_helper The options helper.
42 */
43 public function __construct(
44 File_Runner $runner,
45 Post_Type_Helper $post_type_helper,
46 Options_Helper $options_helper
47 ) {
48 $this->runner = $runner;
49 $this->post_type_helper = $post_type_helper;
50 $this->options_helper = $options_helper;
51 }
52
53 /**
54 * Returns a configuration
55 *
56 * @return array<string, array<string>|array<string, string|array<string, array<string, int>>>>
57 */
58 public function get_configuration(): array {
59 $this->runner->run();
60
61 $configuration = [
62 'generationFailure' => ! $this->runner->is_successful(),
63 'generationFailureReason' => $this->runner->get_generation_failure_reason(),
64 'llmsTxtUrl' => \home_url( 'llms.txt' ),
65 'disabledPageIndexables' => ( $this->post_type_helper->is_of_indexable_post_type( 'page' ) === false ),
66 'otherIncludedPagesLimit' => $this->options_helper->get_other_included_pages_limit(),
67 ];
68
69 return $configuration;
70 }
71 }
72