commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ExtensionBadResponseErrorModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
24  public const DISCRIMINATOR_VALUE = 'ExtensionBadResponse';
29  protected $code;
30 
35  protected $message;
36 
41  protected $localizedMessage;
42 
48 
53  protected $extensionErrors;
54 
59  protected $extensionBody;
60 
66 
71  protected $extensionId;
72 
77  protected $extensionKey;
78 
79 
83  public function __construct(
84  ?string $message = null,
88  ?string $extensionBody = null,
89  ?int $extensionStatusCode = null,
90  ?string $extensionId = null,
91  ?string $extensionKey = null,
92  ?string $code = null
93  ) {
94  $this->message = $message;
95  $this->localizedMessage = $localizedMessage;
96  $this->extensionExtraInfo = $extensionExtraInfo;
97  $this->extensionErrors = $extensionErrors;
98  $this->extensionBody = $extensionBody;
99  $this->extensionStatusCode = $extensionStatusCode;
100  $this->extensionId = $extensionId;
101  $this->extensionKey = $extensionKey;
102  $this->code = $code ?? self::DISCRIMINATOR_VALUE;
103  }
104 
109  public function getCode()
110  {
111  if (is_null($this->code)) {
113  $data = $this->raw(self::FIELD_CODE);
114  if (is_null($data)) {
115  return null;
116  }
117  $this->code = (string) $data;
118  }
119 
120  return $this->code;
121  }
122 
129  public function getMessage()
130  {
131  if (is_null($this->message)) {
133  $data = $this->raw(self::FIELD_MESSAGE);
134  if (is_null($data)) {
135  return null;
136  }
137  $this->message = (string) $data;
138  }
139 
140  return $this->message;
141  }
142 
149  public function getLocalizedMessage()
150  {
151  if (is_null($this->localizedMessage)) {
153  $data = $this->raw(self::FIELD_LOCALIZED_MESSAGE);
154  if (is_null($data)) {
155  return null;
156  }
157 
158  $this->localizedMessage = LocalizedStringModel::of($data);
159  }
160 
162  }
163 
170  public function getExtensionExtraInfo()
171  {
172  if (is_null($this->extensionExtraInfo)) {
174  $data = $this->raw(self::FIELD_EXTENSION_EXTRA_INFO);
175  if (is_null($data)) {
176  return null;
177  }
178  $this->extensionExtraInfo = JsonObjectModel::of($data);
179  }
180 
182  }
183 
190  public function getExtensionErrors()
191  {
192  if (is_null($this->extensionErrors)) {
194  $data = $this->raw(self::FIELD_EXTENSION_ERRORS);
195  if (is_null($data)) {
196  return null;
197  }
198  $this->extensionErrors = ExtensionErrorCollection::fromArray($data);
199  }
200 
201  return $this->extensionErrors;
202  }
203 
210  public function getExtensionBody()
211  {
212  if (is_null($this->extensionBody)) {
214  $data = $this->raw(self::FIELD_EXTENSION_BODY);
215  if (is_null($data)) {
216  return null;
217  }
218  $this->extensionBody = (string) $data;
219  }
220 
221  return $this->extensionBody;
222  }
223 
230  public function getExtensionStatusCode()
231  {
232  if (is_null($this->extensionStatusCode)) {
234  $data = $this->raw(self::FIELD_EXTENSION_STATUS_CODE);
235  if (is_null($data)) {
236  return null;
237  }
238  $this->extensionStatusCode = (int) $data;
239  }
240 
242  }
243 
250  public function getExtensionId()
251  {
252  if (is_null($this->extensionId)) {
254  $data = $this->raw(self::FIELD_EXTENSION_ID);
255  if (is_null($data)) {
256  return null;
257  }
258  $this->extensionId = (string) $data;
259  }
260 
261  return $this->extensionId;
262  }
263 
270  public function getExtensionKey()
271  {
272  if (is_null($this->extensionKey)) {
274  $data = $this->raw(self::FIELD_EXTENSION_KEY);
275  if (is_null($data)) {
276  return null;
277  }
278  $this->extensionKey = (string) $data;
279  }
280 
281  return $this->extensionKey;
282  }
283 
284 
288  public function setMessage(?string $message): void
289  {
290  $this->message = $message;
291  }
292 
297  {
298  $this->localizedMessage = $localizedMessage;
299  }
300 
305  {
306  $this->extensionExtraInfo = $extensionExtraInfo;
307  }
308 
313  {
314  $this->extensionErrors = $extensionErrors;
315  }
316 
320  public function setExtensionBody(?string $extensionBody): void
321  {
322  $this->extensionBody = $extensionBody;
323  }
324 
328  public function setExtensionStatusCode(?int $extensionStatusCode): void
329  {
330  $this->extensionStatusCode = $extensionStatusCode;
331  }
332 
336  public function setExtensionId(?string $extensionId): void
337  {
338  $this->extensionId = $extensionId;
339  }
340 
344  public function setExtensionKey(?string $extensionKey): void
345  {
346  $this->extensionKey = $extensionKey;
347  }
348 
352  public function by(string $key)
353  {
354  $data = $this->raw($key);
355  if (is_null($data)) {
356  return null;
357  }
358 
359  return $data;
360  }
361 }
__construct(?string $message=null, ?LocalizedString $localizedMessage=null, ?JsonObject $extensionExtraInfo=null, ?ExtensionErrorCollection $extensionErrors=null, ?string $extensionBody=null, ?int $extensionStatusCode=null, ?string $extensionId=null, ?string $extensionKey=null, ?string $code=null)
static of($data=null)
Definition: MapperMap.php:45