PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.2
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.2
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 / ai / generator / domain / usage-parameters.php

usage-parameters.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.2, at src/ai/generator/domain/usage-parameters.php

75 lines 1.5 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
5 namespace Yoast\WP\SEO\AI\Generator\Domain;
6
7 use WP_User;
8
9 /**
10 * Parameters for a usage request.
11 */
12 class Usage_Parameters {
13
14 /**
15 * The user the request is on behalf of.
16 *
17 * @var WP_User
18 */
19 private $user;
20
21 /**
22 * Whether usage should be read from the time-unbound free-usage bucket rather than a period.
23 *
24 * @var bool
25 */
26 private $is_free;
27
28 /**
29 * The usage period (e.g. `2026-06`) the request applies to when it is not a free-usage request.
30 *
31 * @var string
32 */
33 private $period;
34
35 /**
36 * The constructor.
37 *
38 * @param WP_User $user The user.
39 * @param bool $is_free Whether to read the free-usage bucket instead of a period.
40 * @param string $period The usage period (e.g. `2026-06`); ignored for free-usage requests.
41 */
42 public function __construct( WP_User $user, bool $is_free, string $period ) {
43 $this->user = $user;
44 $this->is_free = $is_free;
45 $this->period = $period;
46 }
47
48 /**
49 * Returns the user.
50 *
51 * @return WP_User The user.
52 */
53 public function get_user(): WP_User {
54 return $this->user;
55 }
56
57 /**
58 * Returns whether usage should be read from the free-usage bucket.
59 *
60 * @return bool True when the request targets the free-usage bucket.
61 */
62 public function is_free(): bool {
63 return $this->is_free;
64 }
65
66 /**
67 * Returns the usage period the request applies to.
68 *
69 * @return string The usage period (e.g. `2026-06`).
70 */
71 public function get_period(): string {
72 return $this->period;
73 }
74 }
75