commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ApprovalRuleBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
26 use DateTimeImmutable;
27 use stdClass;
28 
32 final class ApprovalRuleBuilder implements Builder
33 {
38  private $id;
39 
44  private $version;
45 
50  private $createdAt;
51 
56  private $lastModifiedAt;
57 
62  private $createdBy;
63 
68  private $lastModifiedBy;
69 
74  private $key;
75 
80  private $name;
81 
86  private $description;
87 
92  private $status;
93 
98  private $predicate;
99 
104  private $approvers;
105 
110  private $requesters;
111 
116  private $businessUnit;
117 
122  private $custom;
123 
130  public function getId()
131  {
132  return $this->id;
133  }
134 
141  public function getVersion()
142  {
143  return $this->version;
144  }
145 
152  public function getCreatedAt()
153  {
154  return $this->createdAt;
155  }
156 
163  public function getLastModifiedAt()
164  {
165  return $this->lastModifiedAt;
166  }
167 
174  public function getCreatedBy()
175  {
176  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
177  }
178 
185  public function getLastModifiedBy()
186  {
187  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
188  }
189 
196  public function getKey()
197  {
198  return $this->key;
199  }
200 
207  public function getName()
208  {
209  return $this->name;
210  }
211 
218  public function getDescription()
219  {
220  return $this->description;
221  }
222 
229  public function getStatus()
230  {
231  return $this->status;
232  }
233 
240  public function getPredicate()
241  {
242  return $this->predicate;
243  }
244 
251  public function getApprovers()
252  {
253  return $this->approvers instanceof ApproverHierarchyBuilder ? $this->approvers->build() : $this->approvers;
254  }
255 
262  public function getRequesters()
263  {
264  return $this->requesters;
265  }
266 
273  public function getBusinessUnit()
274  {
275  return $this->businessUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit;
276  }
277 
284  public function getCustom()
285  {
286  return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
287  }
288 
293  public function withId(?string $id)
294  {
295  $this->id = $id;
296 
297  return $this;
298  }
299 
304  public function withVersion(?int $version)
305  {
306  $this->version = $version;
307 
308  return $this;
309  }
310 
315  public function withCreatedAt(?DateTimeImmutable $createdAt)
316  {
317  $this->createdAt = $createdAt;
318 
319  return $this;
320  }
321 
326  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
327  {
328  $this->lastModifiedAt = $lastModifiedAt;
329 
330  return $this;
331  }
332 
337  public function withCreatedBy(?CreatedBy $createdBy)
338  {
339  $this->createdBy = $createdBy;
340 
341  return $this;
342  }
343 
348  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
349  {
350  $this->lastModifiedBy = $lastModifiedBy;
351 
352  return $this;
353  }
354 
359  public function withKey(?string $key)
360  {
361  $this->key = $key;
362 
363  return $this;
364  }
365 
370  public function withName(?string $name)
371  {
372  $this->name = $name;
373 
374  return $this;
375  }
376 
381  public function withDescription(?string $description)
382  {
383  $this->description = $description;
384 
385  return $this;
386  }
387 
392  public function withStatus(?string $status)
393  {
394  $this->status = $status;
395 
396  return $this;
397  }
398 
403  public function withPredicate(?string $predicate)
404  {
405  $this->predicate = $predicate;
406 
407  return $this;
408  }
409 
414  public function withApprovers(?ApproverHierarchy $approvers)
415  {
416  $this->approvers = $approvers;
417 
418  return $this;
419  }
420 
425  public function withRequesters(?RuleRequesterCollection $requesters)
426  {
427  $this->requesters = $requesters;
428 
429  return $this;
430  }
431 
436  public function withBusinessUnit(?BusinessUnitKeyReference $businessUnit)
437  {
438  $this->businessUnit = $businessUnit;
439 
440  return $this;
441  }
442 
447  public function withCustom(?CustomFields $custom)
448  {
449  $this->custom = $custom;
450 
451  return $this;
452  }
453 
458  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
459  {
460  $this->createdBy = $createdBy;
461 
462  return $this;
463  }
464 
469  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
470  {
471  $this->lastModifiedBy = $lastModifiedBy;
472 
473  return $this;
474  }
475 
480  public function withApproversBuilder(?ApproverHierarchyBuilder $approvers)
481  {
482  $this->approvers = $approvers;
483 
484  return $this;
485  }
486 
492  {
493  $this->businessUnit = $businessUnit;
494 
495  return $this;
496  }
497 
502  public function withCustomBuilder(?CustomFieldsBuilder $custom)
503  {
504  $this->custom = $custom;
505 
506  return $this;
507  }
508 
509  public function build(): ApprovalRule
510  {
511  return new ApprovalRuleModel(
512  $this->id,
513  $this->version,
514  $this->createdAt,
515  $this->lastModifiedAt,
516  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
517  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
518  $this->key,
519  $this->name,
520  $this->description,
521  $this->status,
522  $this->predicate,
523  $this->approvers instanceof ApproverHierarchyBuilder ? $this->approvers->build() : $this->approvers,
524  $this->requesters,
525  $this->businessUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit,
526  $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom
527  );
528  }
529 
530  public static function of(): ApprovalRuleBuilder
531  {
532  return new self();
533  }
534 }
withBusinessUnit(?BusinessUnitKeyReference $businessUnit)
withApproversBuilder(?ApproverHierarchyBuilder $approvers)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withBusinessUnitBuilder(?BusinessUnitKeyReferenceBuilder $businessUnit)