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 / traffic / daily-traffic-data.php

daily-traffic-data.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI trunk, at src/dashboard/domain/traffic/daily-traffic-data.php

50 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\Dashboard\Domain\Traffic;
5
6 use Yoast\WP\SEO\Dashboard\Domain\Data_Provider\Data_Interface;
7
8 /**
9 * Domain object that represents a single Daily Traffic record.
10 */
11 class Daily_Traffic_Data implements Data_Interface {
12
13 /**
14 * The date of the traffic data, in YYYYMMDD format.
15 *
16 * @var string
17 */
18 private $date;
19
20 /**
21 * The traffic data for the date.
22 *
23 * @var Traffic_Data
24 */
25 private $traffic_data;
26
27 /**
28 * The constructor.
29 *
30 * @param string $date The date of the traffic data, in YYYYMMDD format.
31 * @param Traffic_Data $traffic_data The traffic data for the date.
32 */
33 public function __construct( string $date, Traffic_Data $traffic_data ) {
34 $this->date = $date;
35 $this->traffic_data = $traffic_data;
36 }
37
38 /**
39 * The array representation of this domain object.
40 *
41 * @return array<string, string|int>
42 */
43 public function to_array(): array {
44 $result = [];
45 $result['date'] = $this->date;
46
47 return \array_merge( $result, $this->traffic_data->to_array() );
48 }
49 }
50