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

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

58 lines 1.6 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 score result.
8 */
9 class Score_Result {
10
11 /**
12 * The list of the current scores of the score result.
13 *
14 * @var Current_Scores_List
15 */
16 private $current_scores_list;
17
18 /**
19 * The time the query took to get the score results.
20 *
21 * @var float
22 */
23 private $query_time;
24
25 /**
26 * Whether cache was used to get the score results.
27 *
28 * @var bool
29 */
30 private $is_cached_used;
31
32 /**
33 * The constructor.
34 *
35 * @param Current_Scores_List $current_scores_list The list of the current scores of the score result.
36 * @param float $query_time The time the query took to get the score results.
37 * @param bool $is_cached_used Whether cache was used to get the score results.
38 */
39 public function __construct( Current_Scores_List $current_scores_list, float $query_time, bool $is_cached_used ) {
40 $this->current_scores_list = $current_scores_list;
41 $this->query_time = $query_time;
42 $this->is_cached_used = $is_cached_used;
43 }
44
45 /**
46 * Return this object represented by a key value array.
47 *
48 * @return array<string, array<array<string, string|int|array<string, string>>>|float|bool> Returns the name and if the feature is enabled.
49 */
50 public function to_array(): array {
51 return [
52 'scores' => $this->current_scores_list->to_array(),
53 'queryTime' => $this->query_time,
54 'cacheUsed' => $this->is_cached_used,
55 ];
56 }
57 }
58