commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ApprovalFlowBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
30 use DateTimeImmutable;
31 use stdClass;
32 
36 final class ApprovalFlowBuilder implements Builder
37 {
42  private $id;
43 
48  private $version;
49 
54  private $createdAt;
55 
60  private $lastModifiedAt;
61 
66  private $createdBy;
67 
72  private $lastModifiedBy;
73 
78  private $order;
79 
84  private $businessUnit;
85 
90  private $rules;
91 
96  private $status;
97 
102  private $rejection;
103 
108  private $approvals;
109 
114  private $eligibleApprovers;
115 
120  private $pendingApprovers;
121 
126  private $currentTierPendingApprovers;
127 
132  private $custom;
133 
140  public function getId()
141  {
142  return $this->id;
143  }
144 
151  public function getVersion()
152  {
153  return $this->version;
154  }
155 
162  public function getCreatedAt()
163  {
164  return $this->createdAt;
165  }
166 
173  public function getLastModifiedAt()
174  {
175  return $this->lastModifiedAt;
176  }
177 
184  public function getCreatedBy()
185  {
186  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
187  }
188 
195  public function getLastModifiedBy()
196  {
197  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
198  }
199 
206  public function getOrder()
207  {
208  return $this->order instanceof OrderReferenceBuilder ? $this->order->build() : $this->order;
209  }
210 
217  public function getBusinessUnit()
218  {
219  return $this->businessUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit;
220  }
221 
228  public function getRules()
229  {
230  return $this->rules;
231  }
232 
239  public function getStatus()
240  {
241  return $this->status;
242  }
243 
250  public function getRejection()
251  {
252  return $this->rejection instanceof ApprovalFlowRejectionBuilder ? $this->rejection->build() : $this->rejection;
253  }
254 
261  public function getApprovals()
262  {
263  return $this->approvals;
264  }
265 
273  public function getEligibleApprovers()
274  {
275  return $this->eligibleApprovers;
276  }
277 
284  public function getPendingApprovers()
285  {
286  return $this->pendingApprovers;
287  }
288 
296  {
297  return $this->currentTierPendingApprovers;
298  }
299 
306  public function getCustom()
307  {
308  return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
309  }
310 
315  public function withId(?string $id)
316  {
317  $this->id = $id;
318 
319  return $this;
320  }
321 
326  public function withVersion(?int $version)
327  {
328  $this->version = $version;
329 
330  return $this;
331  }
332 
337  public function withCreatedAt(?DateTimeImmutable $createdAt)
338  {
339  $this->createdAt = $createdAt;
340 
341  return $this;
342  }
343 
348  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
349  {
350  $this->lastModifiedAt = $lastModifiedAt;
351 
352  return $this;
353  }
354 
359  public function withCreatedBy(?CreatedBy $createdBy)
360  {
361  $this->createdBy = $createdBy;
362 
363  return $this;
364  }
365 
370  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
371  {
372  $this->lastModifiedBy = $lastModifiedBy;
373 
374  return $this;
375  }
376 
381  public function withOrder(?OrderReference $order)
382  {
383  $this->order = $order;
384 
385  return $this;
386  }
387 
392  public function withBusinessUnit(?BusinessUnitKeyReference $businessUnit)
393  {
394  $this->businessUnit = $businessUnit;
395 
396  return $this;
397  }
398 
403  public function withRules(?ApprovalRuleCollection $rules)
404  {
405  $this->rules = $rules;
406 
407  return $this;
408  }
409 
414  public function withStatus(?string $status)
415  {
416  $this->status = $status;
417 
418  return $this;
419  }
420 
425  public function withRejection(?ApprovalFlowRejection $rejection)
426  {
427  $this->rejection = $rejection;
428 
429  return $this;
430  }
431 
436  public function withApprovals(?ApprovalFlowApprovalCollection $approvals)
437  {
438  $this->approvals = $approvals;
439 
440  return $this;
441  }
442 
447  public function withEligibleApprovers(?RuleApproverCollection $eligibleApprovers)
448  {
449  $this->eligibleApprovers = $eligibleApprovers;
450 
451  return $this;
452  }
453 
458  public function withPendingApprovers(?RuleApproverCollection $pendingApprovers)
459  {
460  $this->pendingApprovers = $pendingApprovers;
461 
462  return $this;
463  }
464 
469  public function withCurrentTierPendingApprovers(?RuleApproverCollection $currentTierPendingApprovers)
470  {
471  $this->currentTierPendingApprovers = $currentTierPendingApprovers;
472 
473  return $this;
474  }
475 
480  public function withCustom(?CustomFields $custom)
481  {
482  $this->custom = $custom;
483 
484  return $this;
485  }
486 
491  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
492  {
493  $this->createdBy = $createdBy;
494 
495  return $this;
496  }
497 
502  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
503  {
504  $this->lastModifiedBy = $lastModifiedBy;
505 
506  return $this;
507  }
508 
513  public function withOrderBuilder(?OrderReferenceBuilder $order)
514  {
515  $this->order = $order;
516 
517  return $this;
518  }
519 
525  {
526  $this->businessUnit = $businessUnit;
527 
528  return $this;
529  }
530 
536  {
537  $this->rejection = $rejection;
538 
539  return $this;
540  }
541 
546  public function withCustomBuilder(?CustomFieldsBuilder $custom)
547  {
548  $this->custom = $custom;
549 
550  return $this;
551  }
552 
553  public function build(): ApprovalFlow
554  {
555  return new ApprovalFlowModel(
556  $this->id,
557  $this->version,
558  $this->createdAt,
559  $this->lastModifiedAt,
560  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
561  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
562  $this->order instanceof OrderReferenceBuilder ? $this->order->build() : $this->order,
563  $this->businessUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit,
564  $this->rules,
565  $this->status,
566  $this->rejection instanceof ApprovalFlowRejectionBuilder ? $this->rejection->build() : $this->rejection,
567  $this->approvals,
568  $this->eligibleApprovers,
569  $this->pendingApprovers,
570  $this->currentTierPendingApprovers,
571  $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom
572  );
573  }
574 
575  public static function of(): ApprovalFlowBuilder
576  {
577  return new self();
578  }
579 }
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withBusinessUnitBuilder(?BusinessUnitKeyReferenceBuilder $businessUnit)
withApprovals(?ApprovalFlowApprovalCollection $approvals)
withRejectionBuilder(?ApprovalFlowRejectionBuilder $rejection)
withBusinessUnit(?BusinessUnitKeyReference $businessUnit)
withEligibleApprovers(?RuleApproverCollection $eligibleApprovers)
withPendingApprovers(?RuleApproverCollection $pendingApprovers)
withCurrentTierPendingApprovers(?RuleApproverCollection $currentTierPendingApprovers)