commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
RecurrencePolicyBuilder.php
1<?php
2
3declare(strict_types=1);
10
24use DateTimeImmutable;
25use stdClass;
26
30final class RecurrencePolicyBuilder implements Builder
31{
36 private $id;
37
42 private $version;
43
48 private $createdAt;
49
54 private $lastModifiedAt;
55
60 private $key;
61
66 private $name;
67
72 private $description;
73
78 private $schedule;
79
84 private $createdBy;
85
90 private $lastModifiedBy;
91
98 public function getId()
99 {
100 return $this->id;
101 }
102
109 public function getVersion()
110 {
111 return $this->version;
112 }
113
120 public function getCreatedAt()
121 {
122 return $this->createdAt;
123 }
124
131 public function getLastModifiedAt()
132 {
133 return $this->lastModifiedAt;
134 }
135
142 public function getKey()
143 {
144 return $this->key;
145 }
146
153 public function getName()
154 {
155 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
156 }
157
164 public function getDescription()
165 {
166 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
167 }
168
175 public function getSchedule()
176 {
177 return $this->schedule instanceof RecurrencePolicyScheduleBuilder ? $this->schedule->build() : $this->schedule;
178 }
179
186 public function getCreatedBy()
187 {
188 return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
189 }
190
197 public function getLastModifiedBy()
198 {
199 return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
200 }
201
206 public function withId(?string $id)
207 {
208 $this->id = $id;
209
210 return $this;
211 }
212
217 public function withVersion(?int $version)
218 {
219 $this->version = $version;
220
221 return $this;
222 }
223
228 public function withCreatedAt(?DateTimeImmutable $createdAt)
229 {
230 $this->createdAt = $createdAt;
231
232 return $this;
233 }
234
239 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
240 {
241 $this->lastModifiedAt = $lastModifiedAt;
242
243 return $this;
244 }
245
250 public function withKey(?string $key)
251 {
252 $this->key = $key;
253
254 return $this;
255 }
256
261 public function withName(?LocalizedString $name)
262 {
263 $this->name = $name;
264
265 return $this;
266 }
267
272 public function withDescription(?LocalizedString $description)
273 {
274 $this->description = $description;
275
276 return $this;
277 }
278
283 public function withSchedule(?RecurrencePolicySchedule $schedule)
284 {
285 $this->schedule = $schedule;
286
287 return $this;
288 }
289
294 public function withCreatedBy(?CreatedBy $createdBy)
295 {
296 $this->createdBy = $createdBy;
297
298 return $this;
299 }
300
305 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
306 {
307 $this->lastModifiedBy = $lastModifiedBy;
308
309 return $this;
310 }
311
317 {
318 $this->name = $name;
319
320 return $this;
321 }
322
327 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
328 {
329 $this->description = $description;
330
331 return $this;
332 }
333
339 {
340 $this->schedule = $schedule;
341
342 return $this;
343 }
344
349 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
350 {
351 $this->createdBy = $createdBy;
352
353 return $this;
354 }
355
360 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
361 {
362 $this->lastModifiedBy = $lastModifiedBy;
363
364 return $this;
365 }
366
367 public function build(): RecurrencePolicy
368 {
369 return new RecurrencePolicyModel(
370 $this->id,
371 $this->version,
372 $this->createdAt,
373 $this->lastModifiedAt,
374 $this->key,
375 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
376 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
377 $this->schedule instanceof RecurrencePolicyScheduleBuilder ? $this->schedule->build() : $this->schedule,
378 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
379 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy
380 );
381 }
382
383 public static function of(): RecurrencePolicyBuilder
384 {
385 return new self();
386 }
387}