commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ErrorResponseBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class ErrorResponseBuilder implements Builder
22 {
27  private $statusCode;
28 
33  private $message;
34 
39  private $error;
40 
45  private $error_description;
46 
51  private $errors;
52 
59  public function getStatusCode()
60  {
61  return $this->statusCode;
62  }
63 
70  public function getMessage()
71  {
72  return $this->message;
73  }
74 
82  public function getError()
83  {
84  return $this->error;
85  }
86 
95  public function getError_description()
96  {
97  return $this->error_description;
98  }
99 
106  public function getErrors()
107  {
108  return $this->errors;
109  }
110 
115  public function withStatusCode(?int $statusCode)
116  {
117  $this->statusCode = $statusCode;
118 
119  return $this;
120  }
121 
126  public function withMessage(?string $message)
127  {
128  $this->message = $message;
129 
130  return $this;
131  }
132 
137  public function withError(?string $error)
138  {
139  $this->error = $error;
140 
141  return $this;
142  }
143 
148  public function withError_description(?string $error_description)
149  {
150  $this->error_description = $error_description;
151 
152  return $this;
153  }
154 
159  public function withErrors(?ErrorObjectCollection $errors)
160  {
161  $this->errors = $errors;
162 
163  return $this;
164  }
165 
166 
167  public function build(): ErrorResponse
168  {
169  return new ErrorResponseModel(
170  $this->statusCode,
171  $this->message,
172  $this->error,
173  $this->error_description,
174  $this->errors
175  );
176  }
177 
178  public static function of(): ErrorResponseBuilder
179  {
180  return new self();
181  }
182 }