PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.4
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.4
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 / services / health-check / postname-permalink-check.php

postname-permalink-check.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.4, at src/services/health-check/postname-permalink-check.php

60 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Services\Health_Check;
4
5 /**
6 * Paasses when permalinks are set to contain the post name.
7 */
8 class Postname_Permalink_Check extends Health_Check {
9
10 /**
11 * Runs the health check.
12 *
13 * @var Postname_Permalink_Runner
14 */
15 private $runner;
16
17 /**
18 * Generates WordPress-friendly health check results.
19 *
20 * @var Postname_Permalink_Reports
21 */
22 private $reports;
23
24 /**
25 * Constructor.
26 *
27 * @param Postname_Permalink_Runner $runner The object that implements the actual health check.
28 * @param Postname_Permalink_Reports $reports The object that generates WordPress-friendly results.
29 */
30 public function __construct( Postname_Permalink_Runner $runner, Postname_Permalink_Reports $reports ) {
31 $this->runner = $runner;
32 $this->reports = $reports;
33 $this->reports->set_test_identifier( $this->get_test_identifier() );
34
35 $this->set_runner( $this->runner );
36 }
37
38 /**
39 * Returns the WordPress-friendly health check result.
40 *
41 * @return string[] The WordPress-friendly health check result.
42 */
43 protected function get_result() {
44 if ( $this->runner->is_successful() ) {
45 return $this->reports->get_success_result();
46 }
47
48 return $this->reports->get_has_no_postname_in_permalink_result();
49 }
50
51 /**
52 * Returns whether the health check should be excluded from the results.
53 *
54 * @return bool false, because it's not excluded.
55 */
56 public function is_excluded() {
57 return false;
58 }
59 }
60