commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ReviewDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
22 use stdClass;
23 
27 final class ReviewDraftBuilder implements Builder
28 {
33  private $key;
34 
39  private $uniquenessValue;
40 
45  private $locale;
46 
51  private $authorName;
52 
57  private $title;
58 
63  private $text;
64 
69  private $target;
70 
75  private $state;
76 
81  private $rating;
82 
87  private $customer;
88 
93  private $custom;
94 
101  public function getKey()
102  {
103  return $this->key;
104  }
105 
113  public function getUniquenessValue()
114  {
115  return $this->uniquenessValue;
116  }
117 
124  public function getLocale()
125  {
126  return $this->locale;
127  }
128 
135  public function getAuthorName()
136  {
137  return $this->authorName;
138  }
139 
146  public function getTitle()
147  {
148  return $this->title;
149  }
150 
157  public function getText()
158  {
159  return $this->text;
160  }
161 
168  public function getTarget()
169  {
170  return $this->target;
171  }
172 
179  public function getState()
180  {
181  return $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state;
182  }
183 
192  public function getRating()
193  {
194  return $this->rating;
195  }
196 
203  public function getCustomer()
204  {
205  return $this->customer instanceof CustomerResourceIdentifierBuilder ? $this->customer->build() : $this->customer;
206  }
207 
214  public function getCustom()
215  {
216  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
217  }
218 
223  public function withKey(?string $key)
224  {
225  $this->key = $key;
226 
227  return $this;
228  }
229 
234  public function withUniquenessValue(?string $uniquenessValue)
235  {
236  $this->uniquenessValue = $uniquenessValue;
237 
238  return $this;
239  }
240 
245  public function withLocale(?string $locale)
246  {
247  $this->locale = $locale;
248 
249  return $this;
250  }
251 
256  public function withAuthorName(?string $authorName)
257  {
258  $this->authorName = $authorName;
259 
260  return $this;
261  }
262 
267  public function withTitle(?string $title)
268  {
269  $this->title = $title;
270 
271  return $this;
272  }
273 
278  public function withText(?string $text)
279  {
280  $this->text = $text;
281 
282  return $this;
283  }
284 
289  public function withTarget(?JsonObject $target)
290  {
291  $this->target = $target;
292 
293  return $this;
294  }
295 
300  public function withState(?StateResourceIdentifier $state)
301  {
302  $this->state = $state;
303 
304  return $this;
305  }
306 
311  public function withRating(?int $rating)
312  {
313  $this->rating = $rating;
314 
315  return $this;
316  }
317 
322  public function withCustomer(?CustomerResourceIdentifier $customer)
323  {
324  $this->customer = $customer;
325 
326  return $this;
327  }
328 
333  public function withCustom(?CustomFieldsDraft $custom)
334  {
335  $this->custom = $custom;
336 
337  return $this;
338  }
339 
345  {
346  $this->state = $state;
347 
348  return $this;
349  }
350 
356  {
357  $this->customer = $customer;
358 
359  return $this;
360  }
361 
366  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
367  {
368  $this->custom = $custom;
369 
370  return $this;
371  }
372 
373  public function build(): ReviewDraft
374  {
375  return new ReviewDraftModel(
376  $this->key,
377  $this->uniquenessValue,
378  $this->locale,
379  $this->authorName,
380  $this->title,
381  $this->text,
382  $this->target,
383  $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state,
384  $this->rating,
385  $this->customer instanceof CustomerResourceIdentifierBuilder ? $this->customer->build() : $this->customer,
386  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
387  );
388  }
389 
390  public static function of(): ReviewDraftBuilder
391  {
392  return new self();
393  }
394 }
withCustomerBuilder(?CustomerResourceIdentifierBuilder $customer)
withCustomBuilder(?CustomFieldsDraftBuilder $custom)
withCustomer(?CustomerResourceIdentifier $customer)
withStateBuilder(?StateResourceIdentifierBuilder $state)