commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MessageBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
24 use DateTimeImmutable;
25 use stdClass;
26 
30 final class MessageBuilder 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 
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 getLastModifiedBy()
143  {
144  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
145  }
146 
153  public function getCreatedBy()
154  {
155  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
156  }
157 
165  public function getSequenceNumber()
166  {
167  return $this->sequenceNumber;
168  }
169 
176  public function getResource()
177  {
178  return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource;
179  }
180 
187  public function getResourceVersion()
188  {
189  return $this->resourceVersion;
190  }
191 
199  {
200  return $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers;
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 withSequenceNumber(?int $sequenceNumber)
274  {
275  $this->sequenceNumber = $sequenceNumber;
276 
277  return $this;
278  }
279 
284  public function withResource(?Reference $resource)
285  {
286  $this->resource = $resource;
287 
288  return $this;
289  }
290 
295  public function withResourceVersion(?int $resourceVersion)
296  {
297  $this->resourceVersion = $resourceVersion;
298 
299  return $this;
300  }
301 
306  public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)
307  {
308  $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
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 
339  public function withResourceBuilder(?ReferenceBuilder $resource)
340  {
341  $this->resource = $resource;
342 
343  return $this;
344  }
345 
350  public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers)
351  {
352  $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
353 
354  return $this;
355  }
356 
357  public function build(): Message
358  {
359  return new MessageModel(
360  $this->id,
361  $this->version,
362  $this->createdAt,
363  $this->lastModifiedAt,
364  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
365  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
366  $this->sequenceNumber,
367  $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource,
368  $this->resourceVersion,
369  $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers
370  );
371  }
372 
373  public static function of(): MessageBuilder
374  {
375  return new self();
376  }
377 }
withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)
withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers)
withCreatedAt(?DateTimeImmutable $createdAt)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withResourceBuilder(?ReferenceBuilder $resource)
withCreatedByBuilder(?CreatedByBuilder $createdBy)
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
withLastModifiedBy(?LastModifiedBy $lastModifiedBy)