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
197 public function getTimeoutInMs()
198 {
199 return $this->timeoutInMs;
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 withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
251 {
252 $this->lastModifiedBy = $lastModifiedBy;
253
254 return $this;
255 }
256
261 public function withCreatedBy(?CreatedBy $createdBy)
262 {
263 $this->createdBy = $createdBy;
264
265 return $this;
266 }
267
272 public function withKey(?string $key)
273 {
274 $this->key = $key;
275
276 return $this;
277 }
278
283 public function withDestination(?ExtensionDestination $destination)
284 {
285 $this->destination = $destination;
286
287 return $this;
288 }
289
294 public function withTriggers(?ExtensionTriggerCollection $triggers)
295 {
296 $this->triggers = $triggers;
297
298 return $this;
299 }
300
305 public function withTimeoutInMs(?int $timeoutInMs)
306 {
307 $this->timeoutInMs = $timeoutInMs;
308
309 return $this;
310 }
311
316 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
317 {
318 $this->lastModifiedBy = $lastModifiedBy;
319
320 return $this;
321 }
322
327 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
328 {
329 $this->createdBy = $createdBy;
330
331 return $this;
332 }
333
339 {
340 $this->destination = $destination;
341
342 return $this;
343 }
344
345 public function build(): Extension
346 {
347 return new ExtensionModel(
348 $this->id,
349 $this->version,
350 $this->createdAt,
351 $this->lastModifiedAt,
352 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
353 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
354 $this->key,
355 $this->destination instanceof ExtensionDestinationBuilder ? $this->destination->build() : $this->destination,
356 $this->triggers,
357 $this->timeoutInMs
358 );
359 }
360
361 public static function of(): ExtensionBuilder
362 {
363 return new self();
364 }
365}
withDestinationBuilder(?ExtensionDestinationBuilder $destination)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
withDestination(?ExtensionDestination $destination)
withTriggers(?ExtensionTriggerCollection $triggers)