commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ProductCreatedMessageBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
24 use DateTimeImmutable;
25 use stdClass;
26 
30 final class ProductCreatedMessageBuilder implements Builder
31 {
36  private $id;
37 
42  private $version;
43 
48  private $createdAt;
49 
54  private $lastModifiedAt;
55 
60  private $lastModifiedBy;
61 
66  private $createdBy;
67 
72  private $sequenceNumber;
73 
78  private $resource;
79 
84  private $resourceVersion;
85 
90  private $resourceUserProvidedIdentifiers;
91 
96  private $productProjection;
97 
104  public function getId()
105  {
106  return $this->id;
107  }
108 
115  public function getVersion()
116  {
117  return $this->version;
118  }
119 
126  public function getCreatedAt()
127  {
128  return $this->createdAt;
129  }
130 
137  public function getLastModifiedAt()
138  {
139  return $this->lastModifiedAt;
140  }
141 
148  public function getLastModifiedBy()
149  {
150  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
151  }
152 
159  public function getCreatedBy()
160  {
161  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
162  }
163 
171  public function getSequenceNumber()
172  {
173  return $this->sequenceNumber;
174  }
175 
182  public function getResource()
183  {
184  return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource;
185  }
186 
193  public function getResourceVersion()
194  {
195  return $this->resourceVersion;
196  }
197 
205  {
206  return $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers;
207  }
208 
215  public function getProductProjection()
216  {
217  return $this->productProjection instanceof ProductProjectionBuilder ? $this->productProjection->build() : $this->productProjection;
218  }
219 
224  public function withId(?string $id)
225  {
226  $this->id = $id;
227 
228  return $this;
229  }
230 
235  public function withVersion(?int $version)
236  {
237  $this->version = $version;
238 
239  return $this;
240  }
241 
246  public function withCreatedAt(?DateTimeImmutable $createdAt)
247  {
248  $this->createdAt = $createdAt;
249 
250  return $this;
251  }
252 
257  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
258  {
259  $this->lastModifiedAt = $lastModifiedAt;
260 
261  return $this;
262  }
263 
268  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
269  {
270  $this->lastModifiedBy = $lastModifiedBy;
271 
272  return $this;
273  }
274 
279  public function withCreatedBy(?CreatedBy $createdBy)
280  {
281  $this->createdBy = $createdBy;
282 
283  return $this;
284  }
285 
290  public function withSequenceNumber(?int $sequenceNumber)
291  {
292  $this->sequenceNumber = $sequenceNumber;
293 
294  return $this;
295  }
296 
301  public function withResource(?Reference $resource)
302  {
303  $this->resource = $resource;
304 
305  return $this;
306  }
307 
312  public function withResourceVersion(?int $resourceVersion)
313  {
314  $this->resourceVersion = $resourceVersion;
315 
316  return $this;
317  }
318 
323  public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)
324  {
325  $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
326 
327  return $this;
328  }
329 
334  public function withProductProjection(?ProductProjection $productProjection)
335  {
336  $this->productProjection = $productProjection;
337 
338  return $this;
339  }
340 
345  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
346  {
347  $this->lastModifiedBy = $lastModifiedBy;
348 
349  return $this;
350  }
351 
356  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
357  {
358  $this->createdBy = $createdBy;
359 
360  return $this;
361  }
362 
367  public function withResourceBuilder(?ReferenceBuilder $resource)
368  {
369  $this->resource = $resource;
370 
371  return $this;
372  }
373 
378  public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers)
379  {
380  $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
381 
382  return $this;
383  }
384 
389  public function withProductProjectionBuilder(?ProductProjectionBuilder $productProjection)
390  {
391  $this->productProjection = $productProjection;
392 
393  return $this;
394  }
395 
396  public function build(): ProductCreatedMessage
397  {
398  return new ProductCreatedMessageModel(
399  $this->id,
400  $this->version,
401  $this->createdAt,
402  $this->lastModifiedAt,
403  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
404  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
405  $this->sequenceNumber,
406  $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource,
407  $this->resourceVersion,
408  $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers,
409  $this->productProjection instanceof ProductProjectionBuilder ? $this->productProjection->build() : $this->productProjection
410  );
411  }
412 
413  public static function of(): ProductCreatedMessageBuilder
414  {
415  return new self();
416  }
417 }
withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)
withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers)
withProductProjectionBuilder(?ProductProjectionBuilder $productProjection)