commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
SubscriptionBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
22 use DateTimeImmutable;
23 use stdClass;
24 
28 final class SubscriptionBuilder implements Builder
29 {
34  private $id;
35 
40  private $version;
41 
46  private $createdAt;
47 
52  private $lastModifiedAt;
53 
58  private $lastModifiedBy;
59 
64  private $createdBy;
65 
70  private $changes;
71 
76  private $destination;
77 
82  private $key;
83 
88  private $messages;
89 
94  private $format;
95 
100  private $status;
101 
108  public function getId()
109  {
110  return $this->id;
111  }
112 
119  public function getVersion()
120  {
121  return $this->version;
122  }
123 
130  public function getCreatedAt()
131  {
132  return $this->createdAt;
133  }
134 
141  public function getLastModifiedAt()
142  {
143  return $this->lastModifiedAt;
144  }
145 
152  public function getLastModifiedBy()
153  {
154  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
155  }
156 
163  public function getCreatedBy()
164  {
165  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
166  }
167 
174  public function getChanges()
175  {
176  return $this->changes;
177  }
178 
185  public function getDestination()
186  {
187  return $this->destination instanceof DestinationBuilder ? $this->destination->build() : $this->destination;
188  }
189 
196  public function getKey()
197  {
198  return $this->key;
199  }
200 
207  public function getMessages()
208  {
209  return $this->messages;
210  }
211 
218  public function getFormat()
219  {
220  return $this->format instanceof DeliveryFormatBuilder ? $this->format->build() : $this->format;
221  }
222 
229  public function getStatus()
230  {
231  return $this->status;
232  }
233 
238  public function withId(?string $id)
239  {
240  $this->id = $id;
241 
242  return $this;
243  }
244 
249  public function withVersion(?int $version)
250  {
251  $this->version = $version;
252 
253  return $this;
254  }
255 
260  public function withCreatedAt(?DateTimeImmutable $createdAt)
261  {
262  $this->createdAt = $createdAt;
263 
264  return $this;
265  }
266 
271  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
272  {
273  $this->lastModifiedAt = $lastModifiedAt;
274 
275  return $this;
276  }
277 
282  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
283  {
284  $this->lastModifiedBy = $lastModifiedBy;
285 
286  return $this;
287  }
288 
293  public function withCreatedBy(?CreatedBy $createdBy)
294  {
295  $this->createdBy = $createdBy;
296 
297  return $this;
298  }
299 
304  public function withChanges(?ChangeSubscriptionCollection $changes)
305  {
306  $this->changes = $changes;
307 
308  return $this;
309  }
310 
315  public function withDestination(?Destination $destination)
316  {
317  $this->destination = $destination;
318 
319  return $this;
320  }
321 
326  public function withKey(?string $key)
327  {
328  $this->key = $key;
329 
330  return $this;
331  }
332 
337  public function withMessages(?MessageSubscriptionCollection $messages)
338  {
339  $this->messages = $messages;
340 
341  return $this;
342  }
343 
348  public function withFormat(?DeliveryFormat $format)
349  {
350  $this->format = $format;
351 
352  return $this;
353  }
354 
359  public function withStatus(?string $status)
360  {
361  $this->status = $status;
362 
363  return $this;
364  }
365 
370  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
371  {
372  $this->lastModifiedBy = $lastModifiedBy;
373 
374  return $this;
375  }
376 
381  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
382  {
383  $this->createdBy = $createdBy;
384 
385  return $this;
386  }
387 
392  public function withDestinationBuilder(?DestinationBuilder $destination)
393  {
394  $this->destination = $destination;
395 
396  return $this;
397  }
398 
403  public function withFormatBuilder(?DeliveryFormatBuilder $format)
404  {
405  $this->format = $format;
406 
407  return $this;
408  }
409 
410  public function build(): Subscription
411  {
412  return new SubscriptionModel(
413  $this->id,
414  $this->version,
415  $this->createdAt,
416  $this->lastModifiedAt,
417  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
418  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
419  $this->changes,
420  $this->destination instanceof DestinationBuilder ? $this->destination->build() : $this->destination,
421  $this->key,
422  $this->messages,
423  $this->format instanceof DeliveryFormatBuilder ? $this->format->build() : $this->format,
424  $this->status
425  );
426  }
427 
428  public static function of(): SubscriptionBuilder
429  {
430  return new self();
431  }
432 }
withMessages(?MessageSubscriptionCollection $messages)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)