commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
All Classes Namespaces Functions Variables Pages
SubscriptionBuilder.php
1<?php
2
3declare(strict_types=1);
10
22use DateTimeImmutable;
23use stdClass;
24
28final 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 $events;
95
100 private $format;
101
106 private $status;
107
114 public function getId()
115 {
116 return $this->id;
117 }
118
125 public function getVersion()
126 {
127 return $this->version;
128 }
129
136 public function getCreatedAt()
137 {
138 return $this->createdAt;
139 }
140
147 public function getLastModifiedAt()
148 {
149 return $this->lastModifiedAt;
150 }
151
158 public function getLastModifiedBy()
159 {
160 return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
161 }
162
169 public function getCreatedBy()
170 {
171 return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
172 }
173
180 public function getChanges()
181 {
182 return $this->changes;
183 }
184
191 public function getDestination()
192 {
193 return $this->destination instanceof DestinationBuilder ? $this->destination->build() : $this->destination;
194 }
195
202 public function getKey()
203 {
204 return $this->key;
205 }
206
213 public function getMessages()
214 {
215 return $this->messages;
216 }
217
224 public function getEvents()
225 {
226 return $this->events;
227 }
228
235 public function getFormat()
236 {
237 return $this->format instanceof DeliveryFormatBuilder ? $this->format->build() : $this->format;
238 }
239
246 public function getStatus()
247 {
248 return $this->status;
249 }
250
255 public function withId(?string $id)
256 {
257 $this->id = $id;
258
259 return $this;
260 }
261
266 public function withVersion(?int $version)
267 {
268 $this->version = $version;
269
270 return $this;
271 }
272
277 public function withCreatedAt(?DateTimeImmutable $createdAt)
278 {
279 $this->createdAt = $createdAt;
280
281 return $this;
282 }
283
288 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
289 {
290 $this->lastModifiedAt = $lastModifiedAt;
291
292 return $this;
293 }
294
299 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
300 {
301 $this->lastModifiedBy = $lastModifiedBy;
302
303 return $this;
304 }
305
310 public function withCreatedBy(?CreatedBy $createdBy)
311 {
312 $this->createdBy = $createdBy;
313
314 return $this;
315 }
316
321 public function withChanges(?ChangeSubscriptionCollection $changes)
322 {
323 $this->changes = $changes;
324
325 return $this;
326 }
327
332 public function withDestination(?Destination $destination)
333 {
334 $this->destination = $destination;
335
336 return $this;
337 }
338
343 public function withKey(?string $key)
344 {
345 $this->key = $key;
346
347 return $this;
348 }
349
354 public function withMessages(?MessageSubscriptionCollection $messages)
355 {
356 $this->messages = $messages;
357
358 return $this;
359 }
360
365 public function withEvents(?EventSubscriptionCollection $events)
366 {
367 $this->events = $events;
368
369 return $this;
370 }
371
376 public function withFormat(?DeliveryFormat $format)
377 {
378 $this->format = $format;
379
380 return $this;
381 }
382
387 public function withStatus(?string $status)
388 {
389 $this->status = $status;
390
391 return $this;
392 }
393
398 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
399 {
400 $this->lastModifiedBy = $lastModifiedBy;
401
402 return $this;
403 }
404
409 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
410 {
411 $this->createdBy = $createdBy;
412
413 return $this;
414 }
415
420 public function withDestinationBuilder(?DestinationBuilder $destination)
421 {
422 $this->destination = $destination;
423
424 return $this;
425 }
426
431 public function withFormatBuilder(?DeliveryFormatBuilder $format)
432 {
433 $this->format = $format;
434
435 return $this;
436 }
437
438 public function build(): Subscription
439 {
440 return new SubscriptionModel(
441 $this->id,
442 $this->version,
443 $this->createdAt,
444 $this->lastModifiedAt,
445 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
446 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
447 $this->changes,
448 $this->destination instanceof DestinationBuilder ? $this->destination->build() : $this->destination,
449 $this->key,
450 $this->messages,
451 $this->events,
452 $this->format instanceof DeliveryFormatBuilder ? $this->format->build() : $this->format,
453 $this->status
454 );
455 }
456
457 public static function of(): SubscriptionBuilder
458 {
459 return new self();
460 }
461}
withMessages(?MessageSubscriptionCollection $messages)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)