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
622use DateTimeImmutable;
623use stdClass;
624
628final class BaseResourceBuilder implements Builder
629{
634 private $id;
635
640 private $version;
641
646 private $createdAt;
647
652 private $lastModifiedAt;
653
658 public function getId()
659 {
660 return $this->id;
661 }
662
667 public function getVersion()
668 {
669 return $this->version;
670 }
671
676 public function getCreatedAt()
677 {
678 return $this->createdAt;
679 }
680
685 public function getLastModifiedAt()
686 {
687 return $this->lastModifiedAt;
688 }
689
694 public function withId(?string $id)
695 {
696 $this->id = $id;
697
698 return $this;
699 }
700
705 public function withVersion(?int $version)
706 {
707 $this->version = $version;
708
709 return $this;
710 }
711
716 public function withCreatedAt(?DateTimeImmutable $createdAt)
717 {
718 $this->createdAt = $createdAt;
719
720 return $this;
721 }
722
727 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
728 {
729 $this->lastModifiedAt = $lastModifiedAt;
730
731 return $this;
732 }
733
734
735 public function build(): BaseResource
736 {
737 return new BaseResourceModel(
738 $this->id,
739 $this->version,
740 $this->createdAt,
741 $this->lastModifiedAt
742 );
743 }
744
745 public static function of(): BaseResourceBuilder
746 {
747 return new self();
748 }
749}
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)