commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
All Classes Namespaces Functions Variables Pages
BaseResourceBuilder.php
1<?php
2
3declare(strict_types=1);
10
494use DateTimeImmutable;
495use stdClass;
496
500final class BaseResourceBuilder implements Builder
501{
506 private $id;
507
512 private $version;
513
518 private $createdAt;
519
524 private $lastModifiedAt;
525
530 public function getId()
531 {
532 return $this->id;
533 }
534
539 public function getVersion()
540 {
541 return $this->version;
542 }
543
548 public function getCreatedAt()
549 {
550 return $this->createdAt;
551 }
552
557 public function getLastModifiedAt()
558 {
559 return $this->lastModifiedAt;
560 }
561
566 public function withId(?string $id)
567 {
568 $this->id = $id;
569
570 return $this;
571 }
572
577 public function withVersion(?int $version)
578 {
579 $this->version = $version;
580
581 return $this;
582 }
583
588 public function withCreatedAt(?DateTimeImmutable $createdAt)
589 {
590 $this->createdAt = $createdAt;
591
592 return $this;
593 }
594
599 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
600 {
601 $this->lastModifiedAt = $lastModifiedAt;
602
603 return $this;
604 }
605
606
607 public function build(): BaseResource
608 {
609 return new BaseResourceModel(
610 $this->id,
611 $this->version,
612 $this->createdAt,
613 $this->lastModifiedAt
614 );
615 }
616
617 public static function of(): BaseResourceBuilder
618 {
619 return new self();
620 }
621}
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)