| 1 |
<?php |
| 2 |
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure. |
| 3 |
|
| 4 |
namespace Yoast\WP\SEO\AI\Content_Planner\Application; |
| 5 |
|
| 6 |
use WP_User; |
| 7 |
use Yoast\WP\SEO\AI\Content_Planner\Domain\Category; |
| 8 |
|
| 9 |
/** |
| 10 |
* Command for requesting a content outline. |
| 11 |
*/ |
| 12 |
class Content_Outline_Command { |
| 13 |
|
| 14 |
/** |
| 15 |
* The user. |
| 16 |
* |
| 17 |
* @var WP_User |
| 18 |
*/ |
| 19 |
private $user; |
| 20 |
|
| 21 |
/** |
| 22 |
* The post type. |
| 23 |
* |
| 24 |
* @var string |
| 25 |
*/ |
| 26 |
private $post_type; |
| 27 |
|
| 28 |
/** |
| 29 |
* The language. |
| 30 |
* |
| 31 |
* @var string |
| 32 |
*/ |
| 33 |
private $language; |
| 34 |
|
| 35 |
/** |
| 36 |
* The editor. |
| 37 |
* |
| 38 |
* @var string |
| 39 |
*/ |
| 40 |
private $editor; |
| 41 |
|
| 42 |
/** |
| 43 |
* The title. |
| 44 |
* |
| 45 |
* @var string |
| 46 |
*/ |
| 47 |
private $title; |
| 48 |
|
| 49 |
/** |
| 50 |
* The intent. |
| 51 |
* |
| 52 |
* @var string |
| 53 |
*/ |
| 54 |
private $intent; |
| 55 |
|
| 56 |
/** |
| 57 |
* The explanation. |
| 58 |
* |
| 59 |
* @var string |
| 60 |
*/ |
| 61 |
private $explanation; |
| 62 |
|
| 63 |
/** |
| 64 |
* The keyphrase. |
| 65 |
* |
| 66 |
* @var string |
| 67 |
*/ |
| 68 |
private $keyphrase; |
| 69 |
|
| 70 |
/** |
| 71 |
* The meta description. |
| 72 |
* |
| 73 |
* @var string |
| 74 |
*/ |
| 75 |
private $meta_description; |
| 76 |
|
| 77 |
/** |
| 78 |
* The category. |
| 79 |
* |
| 80 |
* @var Category |
| 81 |
*/ |
| 82 |
private $category; |
| 83 |
|
| 84 |
/** |
| 85 |
* The recent content from the suggestions response. |
| 86 |
* |
| 87 |
* @var array<array<string, string|bool|array<string, int>>> |
| 88 |
*/ |
| 89 |
private $recent_content; |
| 90 |
|
| 91 |
/** |
| 92 |
* The constructor. |
| 93 |
* |
| 94 |
* @param WP_User $user The user. |
| 95 |
* @param string $post_type The post type. |
| 96 |
* @param string $language The language. |
| 97 |
* @param string $editor The editor. |
| 98 |
* @param string $title The title. |
| 99 |
* @param string $intent The intent. |
| 100 |
* @param string $explanation The explanation. |
| 101 |
* @param string $keyphrase The keyphrase. |
| 102 |
* @param string $meta_description The meta description. |
| 103 |
* @param string $category_name The category name. |
| 104 |
* @param int $category_id The category ID. |
| 105 |
* @param array<array<string, string|bool|array<string, int>>> $recent_content The recent content from the suggestions response. |
| 106 |
*/ |
| 107 |
public function __construct( |
| 108 |
WP_User $user, |
| 109 |
string $post_type, |
| 110 |
string $language, |
| 111 |
string $editor, |
| 112 |
string $title, |
| 113 |
string $intent, |
| 114 |
string $explanation, |
| 115 |
string $keyphrase, |
| 116 |
string $meta_description, |
| 117 |
string $category_name, |
| 118 |
int $category_id, |
| 119 |
array $recent_content |
| 120 |
) { |
| 121 |
$this->user = $user; |
| 122 |
$this->post_type = $post_type; |
| 123 |
$this->language = $language; |
| 124 |
$this->editor = $editor; |
| 125 |
$this->title = $title; |
| 126 |
$this->intent = $intent; |
| 127 |
$this->explanation = $explanation; |
| 128 |
$this->keyphrase = $keyphrase; |
| 129 |
$this->meta_description = $meta_description; |
| 130 |
$this->category = new Category( $category_name, $category_id ); |
| 131 |
$this->recent_content = $recent_content; |
| 132 |
} |
| 133 |
|
| 134 |
/** |
| 135 |
* Returns the user. |
| 136 |
* |
| 137 |
* @return WP_User The user. |
| 138 |
*/ |
| 139 |
public function get_user(): WP_User { |
| 140 |
return $this->user; |
| 141 |
} |
| 142 |
|
| 143 |
/** |
| 144 |
* Returns the post type. |
| 145 |
* |
| 146 |
* @return string The post type. |
| 147 |
*/ |
| 148 |
public function get_post_type(): string { |
| 149 |
return $this->post_type; |
| 150 |
} |
| 151 |
|
| 152 |
/** |
| 153 |
* Returns the language. |
| 154 |
* |
| 155 |
* @return string The language. |
| 156 |
*/ |
| 157 |
public function get_language(): string { |
| 158 |
return $this->language; |
| 159 |
} |
| 160 |
|
| 161 |
/** |
| 162 |
* Returns the editor. |
| 163 |
* |
| 164 |
* @return string The editor. |
| 165 |
*/ |
| 166 |
public function get_editor(): string { |
| 167 |
return $this->editor; |
| 168 |
} |
| 169 |
|
| 170 |
/** |
| 171 |
* Returns the title. |
| 172 |
* |
| 173 |
* @return string The title. |
| 174 |
*/ |
| 175 |
public function get_title(): string { |
| 176 |
return $this->title; |
| 177 |
} |
| 178 |
|
| 179 |
/** |
| 180 |
* Returns the intent. |
| 181 |
* |
| 182 |
* @return string The intent. |
| 183 |
*/ |
| 184 |
public function get_intent(): string { |
| 185 |
return $this->intent; |
| 186 |
} |
| 187 |
|
| 188 |
/** |
| 189 |
* Returns the explanation. |
| 190 |
* |
| 191 |
* @return string The explanation. |
| 192 |
*/ |
| 193 |
public function get_explanation(): string { |
| 194 |
return $this->explanation; |
| 195 |
} |
| 196 |
|
| 197 |
/** |
| 198 |
* Returns the keyphrase. |
| 199 |
* |
| 200 |
* @return string The keyphrase. |
| 201 |
*/ |
| 202 |
public function get_keyphrase(): string { |
| 203 |
return $this->keyphrase; |
| 204 |
} |
| 205 |
|
| 206 |
/** |
| 207 |
* Returns the meta description. |
| 208 |
* |
| 209 |
* @return string The meta description. |
| 210 |
*/ |
| 211 |
public function get_meta_description(): string { |
| 212 |
return $this->meta_description; |
| 213 |
} |
| 214 |
|
| 215 |
/** |
| 216 |
* Returns the category. |
| 217 |
* |
| 218 |
* @return Category The category. |
| 219 |
*/ |
| 220 |
public function get_category(): Category { |
| 221 |
return $this->category; |
| 222 |
} |
| 223 |
|
| 224 |
/** |
| 225 |
* Returns the recent content from the suggestions response. |
| 226 |
* |
| 227 |
* @return array<array<string, string|bool|array<string, int>>> The recent content. |
| 228 |
*/ |
| 229 |
public function get_recent_content(): array { |
| 230 |
return $this->recent_content; |
| 231 |
} |
| 232 |
} |
| 233 |
|