PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.8
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.8
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 / http-request / domain / response.php

response.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 27.8, at src/ai/http-request/domain/response.php

110 lines 2.1 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\HTTP_Request\Domain;
6
7 /**
8 * Class Response
9 * Represents a response from the AI Generator API.
10 */
11 class Response {
12
13 /**
14 * The response body.
15 *
16 * @var string
17 */
18 private $body;
19
20 /**
21 * The response code.
22 *
23 * @var int
24 */
25 private $response_code;
26
27 /**
28 * The response message.
29 *
30 * @var string
31 */
32 private $message;
33
34 /**
35 * The error code.
36 *
37 * @var string
38 */
39 private $error_code;
40
41 /**
42 * The missing licenses.
43 *
44 * @var array<string>
45 */
46 private $missing_licenses;
47
48 /**
49 * Response constructor.
50 *
51 * @param string $body The response body.
52 * @param int $response_code The response code.
53 * @param string $message The response message.
54 * @param string $error_code The error code.
55 * @param array<string> $missing_licenses The missing licenses.
56 */
57 public function __construct( string $body, int $response_code, string $message, string $error_code = '', $missing_licenses = [] ) {
58 $this->body = $body;
59 $this->response_code = $response_code;
60 $this->message = $message;
61 $this->error_code = $error_code;
62 $this->missing_licenses = $missing_licenses;
63 }
64
65 /**
66 * Gets the response body.
67 *
68 * @return string The response body.
69 */
70 public function get_body() {
71 return $this->body;
72 }
73
74 /**
75 * Gets the response code.
76 *
77 * @return int The response code.
78 */
79 public function get_response_code(): int {
80 return $this->response_code;
81 }
82
83 /**
84 * Gets the response message.
85 *
86 * @return string The response message.
87 */
88 public function get_message(): string {
89 return $this->message;
90 }
91
92 /**
93 * Gets the error code.
94 *
95 * @return string The error code.
96 */
97 public function get_error_code(): string {
98 return $this->error_code;
99 }
100
101 /**
102 * Gets the missing licenses.
103 *
104 * @return array<string> The missing licenses.
105 */
106 public function get_missing_licenses(): array {
107 return $this->missing_licenses;
108 }
109 }
110