PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.9
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.9
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 / dashboard / domain / score-results / current-score.php

current-score.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 27.9, at src/dashboard/domain/score-results/current-score.php

102 lines 2.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\Dashboard\Domain\Score_Results;
5
6 /**
7 * This class describes a current score.
8 */
9 class Current_Score {
10
11 /**
12 * The name of the current score.
13 *
14 * @var string
15 */
16 private $name;
17
18 /**
19 * The amount of the current score.
20 *
21 * @var string
22 */
23 private $amount;
24
25 /**
26 * The ids of the current score.
27 *
28 * @var string|null
29 */
30 private $ids;
31
32 /**
33 * The links of the current score.
34 *
35 * @var array<string, string>|null
36 */
37 private $links;
38
39 /**
40 * The constructor.
41 *
42 * @param string $name The name of the current score.
43 * @param int $amount The amount of the current score.
44 * @param string|null $ids The ids of the current score.
45 * @param array<string, string>|null $links The links of the current score.
46 */
47 public function __construct( string $name, int $amount, ?string $ids = null, ?array $links = null ) {
48 $this->name = $name;
49 $this->amount = $amount;
50 $this->ids = $ids;
51 $this->links = $links;
52 }
53
54 /**
55 * Gets name of the current score.
56 *
57 * @return string The name of the current score.
58 */
59 public function get_name(): string {
60 return $this->name;
61 }
62
63 /**
64 * Gets the amount of the current score.
65 *
66 * @return int The amount of the current score.
67 */
68 public function get_amount(): int {
69 return $this->amount;
70 }
71
72 /**
73 * Gets the ids of the current score.
74 *
75 * @return string|null The ids of the current score.
76 */
77 public function get_ids(): ?string {
78 return $this->ids;
79 }
80
81 /**
82 * Gets the links of the current score in the expected key value representation.
83 *
84 * @return array<string, string> The links of the current score in the expected key value representation.
85 */
86 public function get_links_to_array(): ?array {
87 $links = [];
88
89 if ( $this->links === null ) {
90 return $links;
91 }
92
93 foreach ( $this->links as $key => $link ) {
94 if ( $link === null ) {
95 continue;
96 }
97 $links[ $key ] = $link;
98 }
99 return $links;
100 }
101 }
102