commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CustomerTokenBuilder.php
1<?php
2
3declare(strict_types=1);
10
16use DateTimeImmutable;
17use stdClass;
18
22final class CustomerTokenBuilder implements Builder
23{
28 private $id;
29
34 private $customerId;
35
40 private $value;
41
46 private $expiresAt;
47
52 private $invalidateOlderTokens;
53
58 private $createdAt;
59
64 private $lastModifiedAt;
65
72 public function getId()
73 {
74 return $this->id;
75 }
76
83 public function getCustomerId()
84 {
85 return $this->customerId;
86 }
87
94 public function getValue()
95 {
96 return $this->value;
97 }
98
105 public function getExpiresAt()
106 {
107 return $this->expiresAt;
108 }
109
116 public function getInvalidateOlderTokens()
117 {
118 return $this->invalidateOlderTokens;
119 }
120
127 public function getCreatedAt()
128 {
129 return $this->createdAt;
130 }
131
138 public function getLastModifiedAt()
139 {
140 return $this->lastModifiedAt;
141 }
142
147 public function withId(?string $id)
148 {
149 $this->id = $id;
150
151 return $this;
152 }
153
158 public function withCustomerId(?string $customerId)
159 {
160 $this->customerId = $customerId;
161
162 return $this;
163 }
164
169 public function withValue(?string $value)
170 {
171 $this->value = $value;
172
173 return $this;
174 }
175
180 public function withExpiresAt(?DateTimeImmutable $expiresAt)
181 {
182 $this->expiresAt = $expiresAt;
183
184 return $this;
185 }
186
191 public function withInvalidateOlderTokens(?bool $invalidateOlderTokens)
192 {
193 $this->invalidateOlderTokens = $invalidateOlderTokens;
194
195 return $this;
196 }
197
202 public function withCreatedAt(?DateTimeImmutable $createdAt)
203 {
204 $this->createdAt = $createdAt;
205
206 return $this;
207 }
208
213 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
214 {
215 $this->lastModifiedAt = $lastModifiedAt;
216
217 return $this;
218 }
219
220
221 public function build(): CustomerToken
222 {
223 return new CustomerTokenModel(
224 $this->id,
225 $this->customerId,
226 $this->value,
227 $this->expiresAt,
228 $this->invalidateOlderTokens,
229 $this->createdAt,
230 $this->lastModifiedAt
231 );
232 }
233
234 public static function of(): CustomerTokenBuilder
235 {
236 return new self();
237 }
238}