commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ApprovalFlowApprovalBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use DateTimeImmutable;
19 use stdClass;
20 
24 final class ApprovalFlowApprovalBuilder implements Builder
25 {
30  private $approver;
31 
36  private $approvedAt;
37 
44  public function getApprover()
45  {
46  return $this->approver instanceof AssociateBuilder ? $this->approver->build() : $this->approver;
47  }
48 
55  public function getApprovedAt()
56  {
57  return $this->approvedAt;
58  }
59 
64  public function withApprover(?Associate $approver)
65  {
66  $this->approver = $approver;
67 
68  return $this;
69  }
70 
75  public function withApprovedAt(?DateTimeImmutable $approvedAt)
76  {
77  $this->approvedAt = $approvedAt;
78 
79  return $this;
80  }
81 
86  public function withApproverBuilder(?AssociateBuilder $approver)
87  {
88  $this->approver = $approver;
89 
90  return $this;
91  }
92 
93  public function build(): ApprovalFlowApproval
94  {
95  return new ApprovalFlowApprovalModel(
96  $this->approver instanceof AssociateBuilder ? $this->approver->build() : $this->approver,
97  $this->approvedAt
98  );
99  }
100 
101  public static function of(): ApprovalFlowApprovalBuilder
102  {
103  return new self();
104  }
105 }