PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.5
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 / data-provider / data-container.php

data-container.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.5, at src/dashboard/domain/data-provider/data-container.php

59 lines 1.0 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\Data_Provider;
5
6 /**
7 * The data container.
8 */
9 class Data_Container {
10
11 /**
12 * All the data points.
13 *
14 * @var array<Data_Interface>
15 */
16 private $data_container;
17
18 /**
19 * The constructor
20 */
21 public function __construct() {
22 $this->data_container = [];
23 }
24
25 /**
26 * Method to add data.
27 *
28 * @param Data_Interface $data The data.
29 *
30 * @return void
31 */
32 public function add_data( Data_Interface $data ) {
33 $this->data_container[] = $data;
34 }
35
36 /**
37 * Method to get all the data points.
38 *
39 * @return Data_Interface[] All the data points.
40 */
41 public function get_data(): array {
42 return $this->data_container;
43 }
44
45 /**
46 * Converts the data points into an array.
47 *
48 * @return array<string, string> The array of the data points.
49 */
50 public function to_array(): array {
51 $result = [];
52 foreach ( $this->data_container as $data ) {
53 $result[] = $data->to_array();
54 }
55
56 return $result;
57 }
58 }
59