commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ChannelBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
32 use DateTimeImmutable;
33 use stdClass;
34 
38 final class ChannelBuilder implements Builder
39 {
44  private $id;
45 
50  private $version;
51 
56  private $createdAt;
57 
62  private $lastModifiedAt;
63 
68  private $lastModifiedBy;
69 
74  private $createdBy;
75 
80  private $key;
81 
86  private $roles;
87 
92  private $name;
93 
98  private $description;
99 
104  private $address;
105 
110  private $reviewRatingStatistics;
111 
116  private $custom;
117 
122  private $geoLocation;
123 
130  public function getId()
131  {
132  return $this->id;
133  }
134 
141  public function getVersion()
142  {
143  return $this->version;
144  }
145 
152  public function getCreatedAt()
153  {
154  return $this->createdAt;
155  }
156 
163  public function getLastModifiedAt()
164  {
165  return $this->lastModifiedAt;
166  }
167 
174  public function getLastModifiedBy()
175  {
176  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
177  }
178 
185  public function getCreatedBy()
186  {
187  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
188  }
189 
196  public function getKey()
197  {
198  return $this->key;
199  }
200 
207  public function getRoles()
208  {
209  return $this->roles;
210  }
211 
218  public function getName()
219  {
220  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
221  }
222 
229  public function getDescription()
230  {
231  return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
232  }
233 
240  public function getAddress()
241  {
242  return $this->address instanceof AddressBuilder ? $this->address->build() : $this->address;
243  }
244 
251  public function getReviewRatingStatistics()
252  {
253  return $this->reviewRatingStatistics instanceof ReviewRatingStatisticsBuilder ? $this->reviewRatingStatistics->build() : $this->reviewRatingStatistics;
254  }
255 
262  public function getCustom()
263  {
264  return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
265  }
266 
273  public function getGeoLocation()
274  {
275  return $this->geoLocation instanceof GeoJsonBuilder ? $this->geoLocation->build() : $this->geoLocation;
276  }
277 
282  public function withId(?string $id)
283  {
284  $this->id = $id;
285 
286  return $this;
287  }
288 
293  public function withVersion(?int $version)
294  {
295  $this->version = $version;
296 
297  return $this;
298  }
299 
304  public function withCreatedAt(?DateTimeImmutable $createdAt)
305  {
306  $this->createdAt = $createdAt;
307 
308  return $this;
309  }
310 
315  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
316  {
317  $this->lastModifiedAt = $lastModifiedAt;
318 
319  return $this;
320  }
321 
326  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
327  {
328  $this->lastModifiedBy = $lastModifiedBy;
329 
330  return $this;
331  }
332 
337  public function withCreatedBy(?CreatedBy $createdBy)
338  {
339  $this->createdBy = $createdBy;
340 
341  return $this;
342  }
343 
348  public function withKey(?string $key)
349  {
350  $this->key = $key;
351 
352  return $this;
353  }
354 
359  public function withRoles(?array $roles)
360  {
361  $this->roles = $roles;
362 
363  return $this;
364  }
365 
370  public function withName(?LocalizedString $name)
371  {
372  $this->name = $name;
373 
374  return $this;
375  }
376 
381  public function withDescription(?LocalizedString $description)
382  {
383  $this->description = $description;
384 
385  return $this;
386  }
387 
392  public function withAddress(?Address $address)
393  {
394  $this->address = $address;
395 
396  return $this;
397  }
398 
403  public function withReviewRatingStatistics(?ReviewRatingStatistics $reviewRatingStatistics)
404  {
405  $this->reviewRatingStatistics = $reviewRatingStatistics;
406 
407  return $this;
408  }
409 
414  public function withCustom(?CustomFields $custom)
415  {
416  $this->custom = $custom;
417 
418  return $this;
419  }
420 
425  public function withGeoLocation(?GeoJson $geoLocation)
426  {
427  $this->geoLocation = $geoLocation;
428 
429  return $this;
430  }
431 
436  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
437  {
438  $this->lastModifiedBy = $lastModifiedBy;
439 
440  return $this;
441  }
442 
447  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
448  {
449  $this->createdBy = $createdBy;
450 
451  return $this;
452  }
453 
458  public function withNameBuilder(?LocalizedStringBuilder $name)
459  {
460  $this->name = $name;
461 
462  return $this;
463  }
464 
469  public function withDescriptionBuilder(?LocalizedStringBuilder $description)
470  {
471  $this->description = $description;
472 
473  return $this;
474  }
475 
480  public function withAddressBuilder(?AddressBuilder $address)
481  {
482  $this->address = $address;
483 
484  return $this;
485  }
486 
491  public function withReviewRatingStatisticsBuilder(?ReviewRatingStatisticsBuilder $reviewRatingStatistics)
492  {
493  $this->reviewRatingStatistics = $reviewRatingStatistics;
494 
495  return $this;
496  }
497 
502  public function withCustomBuilder(?CustomFieldsBuilder $custom)
503  {
504  $this->custom = $custom;
505 
506  return $this;
507  }
508 
513  public function withGeoLocationBuilder(?GeoJsonBuilder $geoLocation)
514  {
515  $this->geoLocation = $geoLocation;
516 
517  return $this;
518  }
519 
520  public function build(): Channel
521  {
522  return new ChannelModel(
523  $this->id,
524  $this->version,
525  $this->createdAt,
526  $this->lastModifiedAt,
527  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
528  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
529  $this->key,
530  $this->roles,
531  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
532  $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
533  $this->address instanceof AddressBuilder ? $this->address->build() : $this->address,
534  $this->reviewRatingStatistics instanceof ReviewRatingStatisticsBuilder ? $this->reviewRatingStatistics->build() : $this->reviewRatingStatistics,
535  $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom,
536  $this->geoLocation instanceof GeoJsonBuilder ? $this->geoLocation->build() : $this->geoLocation
537  );
538  }
539 
540  public static function of(): ChannelBuilder
541  {
542  return new self();
543  }
544 }
withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withDescription(?LocalizedString $description)
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
withCreatedAt(?DateTimeImmutable $createdAt)
withCustomBuilder(?CustomFieldsBuilder $custom)
withNameBuilder(?LocalizedStringBuilder $name)
withReviewRatingStatisticsBuilder(?ReviewRatingStatisticsBuilder $reviewRatingStatistics)
withDescriptionBuilder(?LocalizedStringBuilder $description)
withGeoLocationBuilder(?GeoJsonBuilder $geoLocation)
withReviewRatingStatistics(?ReviewRatingStatistics $reviewRatingStatistics)
withCreatedByBuilder(?CreatedByBuilder $createdBy)