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 / ai / content-planner / domain / content-suggestion-response.php

content-suggestion-response.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI trunk, at src/ai/content-planner/domain/content-suggestion-response.php

68 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
3 namespace Yoast\WP\SEO\AI\Content_Planner\Domain;
4
5 /**
6 * The response to a content suggestion request, bundling suggestions with the recent content used to generate them.
7 */
8 class Content_Suggestion_Response {
9
10 /**
11 * The content suggestions.
12 *
13 * @var Content_Suggestion_List
14 */
15 private $suggestions;
16
17 /**
18 * The recent content used to generate the suggestions.
19 *
20 * @var Post_List
21 */
22 private $recent_content;
23
24 /**
25 * The constructor.
26 *
27 * @param Content_Suggestion_List $suggestions The content suggestions.
28 * @param Post_List $recent_content The recent content.
29 */
30 public function __construct( Content_Suggestion_List $suggestions, Post_List $recent_content ) {
31 $this->suggestions = $suggestions;
32 $this->recent_content = $recent_content;
33 }
34
35 /**
36 * Returns the content suggestions.
37 *
38 * @return Content_Suggestion_List The content suggestions.
39 */
40 public function get_suggestions(): Content_Suggestion_List {
41 return $this->suggestions;
42 }
43
44 /**
45 * Returns the recent content.
46 *
47 * @return Post_List The recent content.
48 */
49 public function get_recent_content(): Post_List {
50 return $this->recent_content;
51 }
52
53 /**
54 * Returns this object in array format.
55 *
56 * Uses the minimal Post representation so editor-only metadata
57 * (focus keyphrase, cornerstone flag, schema type) never crosses
58 * the REST boundary into the browser.
59 *
60 * @return array<string, array<array<string, string>>> The response as an array.
61 */
62 public function to_array(): array {
63 $result = $this->suggestions->to_array();
64 $result['recent_content'] = $this->recent_content->to_minimal_array();
65 return $result;
66 }
67 }
68