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
484use DateTimeImmutable;
485use stdClass;
486
490final class BaseResourceBuilder implements Builder
491{
496 private $id;
497
502 private $version;
503
508 private $createdAt;
509
514 private $lastModifiedAt;
515
520 public function getId()
521 {
522 return $this->id;
523 }
524
529 public function getVersion()
530 {
531 return $this->version;
532 }
533
538 public function getCreatedAt()
539 {
540 return $this->createdAt;
541 }
542
547 public function getLastModifiedAt()
548 {
549 return $this->lastModifiedAt;
550 }
551
556 public function withId(?string $id)
557 {
558 $this->id = $id;
559
560 return $this;
561 }
562
567 public function withVersion(?int $version)
568 {
569 $this->version = $version;
570
571 return $this;
572 }
573
578 public function withCreatedAt(?DateTimeImmutable $createdAt)
579 {
580 $this->createdAt = $createdAt;
581
582 return $this;
583 }
584
589 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
590 {
591 $this->lastModifiedAt = $lastModifiedAt;
592
593 return $this;
594 }
595
596
597 public function build(): BaseResource
598 {
599 return new BaseResourceModel(
600 $this->id,
601 $this->version,
602 $this->createdAt,
603 $this->lastModifiedAt
604 );
605 }
606
607 public static function of(): BaseResourceBuilder
608 {
609 return new self();
610 }
611}
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)