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

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

68 lines 1.2 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 Traffic record.
10 */
11 class Traffic_Data implements Data_Interface {
12
13 /**
14 * The sessions, if any.
15 *
16 * @var int|null
17 */
18 private $sessions;
19
20 /**
21 * The total users, if any.
22 *
23 * @var int|null
24 */
25 private $total_users;
26
27 /**
28 * The array representation of this domain object.
29 *
30 * @return array<string, int>
31 */
32 public function to_array(): array {
33 $result = [];
34
35 if ( $this->sessions !== null ) {
36 $result['sessions'] = $this->sessions;
37 }
38
39 if ( $this->total_users !== null ) {
40 $result['total_users'] = $this->total_users;
41 }
42
43 return $result;
44 }
45
46 /**
47 * Sets the sessions.
48 *
49 * @param int $sessions The sessions.
50 *
51 * @return void
52 */
53 public function set_sessions( int $sessions ): void {
54 $this->sessions = $sessions;
55 }
56
57 /**
58 * Sets the total users.
59 *
60 * @param int $total_users The total users.
61 *
62 * @return void
63 */
64 public function set_total_users( int $total_users ): void {
65 $this->total_users = $total_users;
66 }
67 }
68