commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ReservationBuilder.php
1<?php
2
3declare(strict_types=1);
10
16use stdClass;
17
21final class ReservationBuilder implements Builder
22{
27 private $quantity;
28
33 private $owner;
34
39 private $createdAt;
40
45 private $checkoutStartedAt;
46
51 public function getQuantity()
52 {
53 return $this->quantity;
54 }
55
62 public function getOwner()
63 {
64 return $this->owner instanceof ReferenceBuilder ? $this->owner->build() : $this->owner;
65 }
66
71 public function getCreatedAt()
72 {
73 return $this->createdAt;
74 }
75
80 public function getCheckoutStartedAt()
81 {
82 return $this->checkoutStartedAt;
83 }
84
89 public function withQuantity(?int $quantity)
90 {
91 $this->quantity = $quantity;
92
93 return $this;
94 }
95
100 public function withOwner(?Reference $owner)
101 {
102 $this->owner = $owner;
103
104 return $this;
105 }
106
111 public function withCreatedAt(?string $createdAt)
112 {
113 $this->createdAt = $createdAt;
114
115 return $this;
116 }
117
122 public function withCheckoutStartedAt(?string $checkoutStartedAt)
123 {
124 $this->checkoutStartedAt = $checkoutStartedAt;
125
126 return $this;
127 }
128
133 public function withOwnerBuilder(?ReferenceBuilder $owner)
134 {
135 $this->owner = $owner;
136
137 return $this;
138 }
139
140 public function build(): Reservation
141 {
142 return new ReservationModel(
143 $this->quantity,
144 $this->owner instanceof ReferenceBuilder ? $this->owner->build() : $this->owner,
145 $this->createdAt,
146 $this->checkoutStartedAt
147 );
148 }
149
150 public static function of(): ReservationBuilder
151 {
152 return new self();
153 }
154}