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.php

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

94 lines 1.9 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 * Value object for a content suggestion.
7 */
8 class Content_Suggestion {
9
10 /**
11 * The title.
12 *
13 * @var string
14 */
15 private $title;
16
17 /**
18 * The intent.
19 *
20 * @var string
21 */
22 private $intent;
23
24 /**
25 * The explanation.
26 *
27 * @var string
28 */
29 private $explanation;
30
31 /**
32 * The keyphrase.
33 *
34 * @var string
35 */
36 private $keyphrase;
37
38 /**
39 * The meta description.
40 *
41 * @var string
42 */
43 private $meta_description;
44
45 /**
46 * The category.
47 *
48 * @var Category
49 */
50 private $category;
51
52 /**
53 * The constructor.
54 *
55 * @param string $title The title.
56 * @param string $intent The intent.
57 * @param string $explanation The explanation.
58 * @param string $keyphrase The keyphrase.
59 * @param string $meta_description The meta description.
60 * @param Category $category The category. Use a Category with name "" and id -1 to represent "no category".
61 */
62 public function __construct(
63 string $title,
64 string $intent,
65 string $explanation,
66 string $keyphrase,
67 string $meta_description,
68 Category $category
69 ) {
70 $this->title = $title;
71 $this->intent = $intent;
72 $this->explanation = $explanation;
73 $this->keyphrase = $keyphrase;
74 $this->meta_description = $meta_description;
75 $this->category = $category;
76 }
77
78 /**
79 * Returns this object in array format.
80 *
81 * @return array<string, string|array<string, int>> The content suggestion as an array.
82 */
83 public function to_array(): array {
84 return [
85 'title' => $this->title,
86 'intent' => $this->intent,
87 'explanation' => $this->explanation,
88 'keyphrase' => $this->keyphrase,
89 'meta_description' => $this->meta_description,
90 'category' => $this->category->to_array(),
91 ];
92 }
93 }
94