| 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 suggestions request. |
| 11 |
*/ |
| 12 |
class Suggestions_Parameters { |
| 13 |
|
| 14 |
/** |
| 15 |
* The user the request is on behalf of. |
| 16 |
* |
| 17 |
* @var WP_User |
| 18 |
*/ |
| 19 |
private $user; |
| 20 |
|
| 21 |
/** |
| 22 |
* The suggestion type that is interpolated into the action path. |
| 23 |
* |
| 24 |
* @var string |
| 25 |
*/ |
| 26 |
private $suggestion_type; |
| 27 |
|
| 28 |
/** |
| 29 |
* The prompt content excerpt taken from the post. |
| 30 |
* |
| 31 |
* @var string |
| 32 |
*/ |
| 33 |
private $prompt_content; |
| 34 |
|
| 35 |
/** |
| 36 |
* The focus keyphrase associated with the post. |
| 37 |
* |
| 38 |
* @var string |
| 39 |
*/ |
| 40 |
private $focus_keyphrase; |
| 41 |
|
| 42 |
/** |
| 43 |
* The language of the post. |
| 44 |
* |
| 45 |
* @var string |
| 46 |
*/ |
| 47 |
private $language; |
| 48 |
|
| 49 |
/** |
| 50 |
* The platform the post is intended for. |
| 51 |
* |
| 52 |
* @var string |
| 53 |
*/ |
| 54 |
private $platform; |
| 55 |
|
| 56 |
/** |
| 57 |
* The editor identifier sent as the X-Yst-Cohort header. |
| 58 |
* |
| 59 |
* @var string |
| 60 |
*/ |
| 61 |
private $editor; |
| 62 |
|
| 63 |
/** |
| 64 |
* The constructor. |
| 65 |
* |
| 66 |
* @param WP_User $user The user. |
| 67 |
* @param string $suggestion_type The suggestion type. |
| 68 |
* @param string $prompt_content The prompt content excerpt. |
| 69 |
* @param string $focus_keyphrase The focus keyphrase. |
| 70 |
* @param string $language The language of the post. |
| 71 |
* @param string $platform The platform. |
| 72 |
* @param string $editor The editor identifier. |
| 73 |
*/ |
| 74 |
public function __construct( |
| 75 |
WP_User $user, |
| 76 |
string $suggestion_type, |
| 77 |
string $prompt_content, |
| 78 |
string $focus_keyphrase, |
| 79 |
string $language, |
| 80 |
string $platform, |
| 81 |
string $editor |
| 82 |
) { |
| 83 |
$this->user = $user; |
| 84 |
$this->suggestion_type = $suggestion_type; |
| 85 |
$this->prompt_content = $prompt_content; |
| 86 |
$this->focus_keyphrase = $focus_keyphrase; |
| 87 |
$this->language = $language; |
| 88 |
$this->platform = $platform; |
| 89 |
$this->editor = $editor; |
| 90 |
} |
| 91 |
|
| 92 |
/** |
| 93 |
* Returns the user. |
| 94 |
* |
| 95 |
* @return WP_User The user. |
| 96 |
*/ |
| 97 |
public function get_user(): WP_User { |
| 98 |
return $this->user; |
| 99 |
} |
| 100 |
|
| 101 |
/** |
| 102 |
* Returns the suggestion type. |
| 103 |
* |
| 104 |
* @return string The suggestion type. |
| 105 |
*/ |
| 106 |
public function get_suggestion_type(): string { |
| 107 |
return $this->suggestion_type; |
| 108 |
} |
| 109 |
|
| 110 |
/** |
| 111 |
* Returns the prompt content excerpt. |
| 112 |
* |
| 113 |
* @return string The prompt content. |
| 114 |
*/ |
| 115 |
public function get_prompt_content(): string { |
| 116 |
return $this->prompt_content; |
| 117 |
} |
| 118 |
|
| 119 |
/** |
| 120 |
* Returns the focus keyphrase. |
| 121 |
* |
| 122 |
* @return string The focus keyphrase. |
| 123 |
*/ |
| 124 |
public function get_focus_keyphrase(): string { |
| 125 |
return $this->focus_keyphrase; |
| 126 |
} |
| 127 |
|
| 128 |
/** |
| 129 |
* Returns the language. |
| 130 |
* |
| 131 |
* @return string The language. |
| 132 |
*/ |
| 133 |
public function get_language(): string { |
| 134 |
return $this->language; |
| 135 |
} |
| 136 |
|
| 137 |
/** |
| 138 |
* Returns the platform. |
| 139 |
* |
| 140 |
* @return string The platform. |
| 141 |
*/ |
| 142 |
public function get_platform(): string { |
| 143 |
return $this->platform; |
| 144 |
} |
| 145 |
|
| 146 |
/** |
| 147 |
* Returns the editor identifier. |
| 148 |
* |
| 149 |
* @return string The editor identifier. |
| 150 |
*/ |
| 151 |
public function get_editor(): string { |
| 152 |
return $this->editor; |
| 153 |
} |
| 154 |
} |
| 155 |
|