commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ExtensionBuilder.php
1<?php
2
3declare(strict_types=1);
10
22use DateTimeImmutable;
23use stdClass;
24
28final class ExtensionBuilder implements Builder
29{
34 private $id;
35
40 private $version;
41
46 private $createdAt;
47
52 private $lastModifiedAt;
53
58 private $lastModifiedBy;
59
64 private $createdBy;
65
70 private $key;
71
76 private $destination;
77
82 private $triggers;
83
88 private $timeoutInMs;
89
96 public function getId()
97 {
98 return $this->id;
99 }
100
107 public function getVersion()
108 {
109 return $this->version;
110 }
111
118 public function getCreatedAt()
119 {
120 return $this->createdAt;
121 }
122
129 public function getLastModifiedAt()
130 {
131 return $this->lastModifiedAt;
132 }
133
140 public function getLastModifiedBy()
141 {
142 return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
143 }
144
151 public function getCreatedBy()
152 {
153 return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
154 }
155
162 public function getKey()
163 {
164 return $this->key;
165 }
166
173 public function getDestination()
174 {
175 return $this->destination instanceof ExtensionDestinationBuilder ? $this->destination->build() : $this->destination;
176 }
177
184 public function getTriggers()
185 {
186 return $this->triggers;
187 }
188
198 public function getTimeoutInMs()
199 {
200 return $this->timeoutInMs;
201 }
202
207 public function withId(?string $id)
208 {
209 $this->id = $id;
210
211 return $this;
212 }
213
218 public function withVersion(?int $version)
219 {
220 $this->version = $version;
221
222 return $this;
223 }
224
229 public function withCreatedAt(?DateTimeImmutable $createdAt)
230 {
231 $this->createdAt = $createdAt;
232
233 return $this;
234 }
235
240 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
241 {
242 $this->lastModifiedAt = $lastModifiedAt;
243
244 return $this;
245 }
246
251 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
252 {
253 $this->lastModifiedBy = $lastModifiedBy;
254
255 return $this;
256 }
257
262 public function withCreatedBy(?CreatedBy $createdBy)
263 {
264 $this->createdBy = $createdBy;
265
266 return $this;
267 }
268
273 public function withKey(?string $key)
274 {
275 $this->key = $key;
276
277 return $this;
278 }
279
284 public function withDestination(?ExtensionDestination $destination)
285 {
286 $this->destination = $destination;
287
288 return $this;
289 }
290
295 public function withTriggers(?ExtensionTriggerCollection $triggers)
296 {
297 $this->triggers = $triggers;
298
299 return $this;
300 }
301
306 public function withTimeoutInMs(?int $timeoutInMs)
307 {
308 $this->timeoutInMs = $timeoutInMs;
309
310 return $this;
311 }
312
317 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
318 {
319 $this->lastModifiedBy = $lastModifiedBy;
320
321 return $this;
322 }
323
328 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
329 {
330 $this->createdBy = $createdBy;
331
332 return $this;
333 }
334
340 {
341 $this->destination = $destination;
342
343 return $this;
344 }
345
346 public function build(): Extension
347 {
348 return new ExtensionModel(
349 $this->id,
350 $this->version,
351 $this->createdAt,
352 $this->lastModifiedAt,
353 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
354 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
355 $this->key,
356 $this->destination instanceof ExtensionDestinationBuilder ? $this->destination->build() : $this->destination,
357 $this->triggers,
358 $this->timeoutInMs
359 );
360 }
361
362 public static function of(): ExtensionBuilder
363 {
364 return new self();
365 }
366}
withDestinationBuilder(?ExtensionDestinationBuilder $destination)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
withDestination(?ExtensionDestination $destination)
withTriggers(?ExtensionTriggerCollection $triggers)