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 / abilities / domain / score-result.php

score-result.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.2, at src/abilities/domain/score-result.php

58 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 -- Needed in the folder structure.
4 namespace Yoast\WP\SEO\Abilities\Domain;
5
6 /**
7 * Immutable value object representing a score result.
8 */
9 class Score_Result {
10
11 /**
12 * The post title.
13 *
14 * @var string
15 */
16 private $title;
17
18 /**
19 * The score slug (na, bad, ok, good).
20 *
21 * @var string
22 */
23 private $score;
24
25 /**
26 * The translated human-readable label.
27 *
28 * @var string
29 */
30 private $label;
31
32 /**
33 * Constructor.
34 *
35 * @param string $title The post title.
36 * @param string $score The score slug.
37 * @param string $label The translated human-readable label.
38 */
39 public function __construct( string $title, string $score, string $label ) {
40 $this->title = $title;
41 $this->score = $score;
42 $this->label = $label;
43 }
44
45 /**
46 * Serializes the score result to an array for ability output.
47 *
48 * @return array<string, string> The serialized score result.
49 */
50 public function to_array(): array {
51 return [
52 'title' => $this->title,
53 'score' => $this->score,
54 'label' => $this->label,
55 ];
56 }
57 }
58