commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
BaseResourceBuilder.php
1<?php
2
3declare(strict_types=1);
10
596use DateTimeImmutable;
597use stdClass;
598
602final class BaseResourceBuilder implements Builder
603{
608 private $id;
609
614 private $version;
615
620 private $createdAt;
621
626 private $lastModifiedAt;
627
632 public function getId()
633 {
634 return $this->id;
635 }
636
641 public function getVersion()
642 {
643 return $this->version;
644 }
645
650 public function getCreatedAt()
651 {
652 return $this->createdAt;
653 }
654
659 public function getLastModifiedAt()
660 {
661 return $this->lastModifiedAt;
662 }
663
668 public function withId(?string $id)
669 {
670 $this->id = $id;
671
672 return $this;
673 }
674
679 public function withVersion(?int $version)
680 {
681 $this->version = $version;
682
683 return $this;
684 }
685
690 public function withCreatedAt(?DateTimeImmutable $createdAt)
691 {
692 $this->createdAt = $createdAt;
693
694 return $this;
695 }
696
701 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
702 {
703 $this->lastModifiedAt = $lastModifiedAt;
704
705 return $this;
706 }
707
708
709 public function build(): BaseResource
710 {
711 return new BaseResourceModel(
712 $this->id,
713 $this->version,
714 $this->createdAt,
715 $this->lastModifiedAt
716 );
717 }
718
719 public static function of(): BaseResourceBuilder
720 {
721 return new self();
722 }
723}
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)