commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ErrorResponseModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
20 final class ErrorResponseModel extends JsonObjectModel implements ErrorResponse
21 {
26  protected $statusCode;
27 
32  protected $message;
33 
38  protected $error;
39 
44  protected $error_description;
45 
50  protected $errors;
51 
52 
56  public function __construct(
57  ?int $statusCode = null,
58  ?string $message = null,
59  ?string $error = null,
60  ?string $error_description = null,
62  ) {
63  $this->statusCode = $statusCode;
64  $this->message = $message;
65  $this->error = $error;
66  $this->error_description = $error_description;
67  $this->errors = $errors;
68  }
69 
76  public function getStatusCode()
77  {
78  if (is_null($this->statusCode)) {
80  $data = $this->raw(self::FIELD_STATUS_CODE);
81  if (is_null($data)) {
82  return null;
83  }
84  $this->statusCode = (int) $data;
85  }
86 
87  return $this->statusCode;
88  }
89 
96  public function getMessage()
97  {
98  if (is_null($this->message)) {
100  $data = $this->raw(self::FIELD_MESSAGE);
101  if (is_null($data)) {
102  return null;
103  }
104  $this->message = (string) $data;
105  }
106 
107  return $this->message;
108  }
109 
117  public function getError()
118  {
119  if (is_null($this->error)) {
121  $data = $this->raw(self::FIELD_ERROR);
122  if (is_null($data)) {
123  return null;
124  }
125  $this->error = (string) $data;
126  }
127 
128  return $this->error;
129  }
130 
139  public function getError_description()
140  {
141  if (is_null($this->error_description)) {
143  $data = $this->raw(self::FIELD_ERROR_DESCRIPTION);
144  if (is_null($data)) {
145  return null;
146  }
147  $this->error_description = (string) $data;
148  }
149 
151  }
152 
159  public function getErrors()
160  {
161  if (is_null($this->errors)) {
163  $data = $this->raw(self::FIELD_ERRORS);
164  if (is_null($data)) {
165  return null;
166  }
167  $this->errors = ErrorObjectCollection::fromArray($data);
168  }
169 
170  return $this->errors;
171  }
172 
173 
177  public function setStatusCode(?int $statusCode): void
178  {
179  $this->statusCode = $statusCode;
180  }
181 
185  public function setMessage(?string $message): void
186  {
187  $this->message = $message;
188  }
189 
193  public function setError(?string $error): void
194  {
195  $this->error = $error;
196  }
197 
201  public function setError_description(?string $error_description): void
202  {
203  $this->error_description = $error_description;
204  }
205 
209  public function setErrors(?ErrorObjectCollection $errors): void
210  {
211  $this->errors = $errors;
212  }
213 }
__construct(?int $statusCode=null, ?string $message=null, ?string $error=null, ?string $error_description=null, ?ErrorObjectCollection $errors=null)