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
682use DateTimeImmutable;
683use stdClass;
684
688final class BaseResourceBuilder implements Builder
689{
694 private $id;
695
700 private $version;
701
706 private $createdAt;
707
712 private $lastModifiedAt;
713
718 public function getId()
719 {
720 return $this->id;
721 }
722
727 public function getVersion()
728 {
729 return $this->version;
730 }
731
736 public function getCreatedAt()
737 {
738 return $this->createdAt;
739 }
740
745 public function getLastModifiedAt()
746 {
747 return $this->lastModifiedAt;
748 }
749
754 public function withId(?string $id)
755 {
756 $this->id = $id;
757
758 return $this;
759 }
760
765 public function withVersion(?int $version)
766 {
767 $this->version = $version;
768
769 return $this;
770 }
771
776 public function withCreatedAt(?DateTimeImmutable $createdAt)
777 {
778 $this->createdAt = $createdAt;
779
780 return $this;
781 }
782
787 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
788 {
789 $this->lastModifiedAt = $lastModifiedAt;
790
791 return $this;
792 }
793
794
795 public function build(): BaseResource
796 {
797 return new BaseResourceModel(
798 $this->id,
799 $this->version,
800 $this->createdAt,
801 $this->lastModifiedAt
802 );
803 }
804
805 public static function of(): BaseResourceBuilder
806 {
807 return new self();
808 }
809}
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)