commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ApprovalRuleDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class ApprovalRuleDraftBuilder implements Builder
22 {
27  private $key;
28 
33  private $name;
34 
39  private $description;
40 
45  private $status;
46 
51  private $predicate;
52 
57  private $approvers;
58 
63  private $requesters;
64 
71  public function getKey()
72  {
73  return $this->key;
74  }
75 
82  public function getName()
83  {
84  return $this->name;
85  }
86 
93  public function getDescription()
94  {
95  return $this->description;
96  }
97 
104  public function getStatus()
105  {
106  return $this->status;
107  }
108 
115  public function getPredicate()
116  {
117  return $this->predicate;
118  }
119 
126  public function getApprovers()
127  {
128  return $this->approvers instanceof ApproverHierarchyDraftBuilder ? $this->approvers->build() : $this->approvers;
129  }
130 
137  public function getRequesters()
138  {
139  return $this->requesters;
140  }
141 
146  public function withKey(?string $key)
147  {
148  $this->key = $key;
149 
150  return $this;
151  }
152 
157  public function withName(?string $name)
158  {
159  $this->name = $name;
160 
161  return $this;
162  }
163 
168  public function withDescription(?string $description)
169  {
170  $this->description = $description;
171 
172  return $this;
173  }
174 
179  public function withStatus(?string $status)
180  {
181  $this->status = $status;
182 
183  return $this;
184  }
185 
190  public function withPredicate(?string $predicate)
191  {
192  $this->predicate = $predicate;
193 
194  return $this;
195  }
196 
201  public function withApprovers(?ApproverHierarchyDraft $approvers)
202  {
203  $this->approvers = $approvers;
204 
205  return $this;
206  }
207 
212  public function withRequesters(?RuleRequesterDraftCollection $requesters)
213  {
214  $this->requesters = $requesters;
215 
216  return $this;
217  }
218 
224  {
225  $this->approvers = $approvers;
226 
227  return $this;
228  }
229 
230  public function build(): ApprovalRuleDraft
231  {
232  return new ApprovalRuleDraftModel(
233  $this->key,
234  $this->name,
235  $this->description,
236  $this->status,
237  $this->predicate,
238  $this->approvers instanceof ApproverHierarchyDraftBuilder ? $this->approvers->build() : $this->approvers,
239  $this->requesters
240  );
241  }
242 
243  public static function of(): ApprovalRuleDraftBuilder
244  {
245  return new self();
246  }
247 }