commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
RecordBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
25 
29 final class RecordBuilder implements Builder
30 {
35  private $version;
36 
41  private $previousVersion;
42 
47  private $type;
48 
53  private $modifiedBy;
54 
59  private $modifiedAt;
60 
65  private $label;
66 
71  private $previousLabel;
72 
77  private $changes;
78 
83  private $resource;
84 
89  private $stores;
90 
95  private $businessUnit;
96 
101  private $withoutChanges;
102 
110  public function getVersion()
111  {
112  return $this->version;
113  }
114 
121  public function getPreviousVersion()
122  {
123  return $this->previousVersion;
124  }
125 
133  public function getType()
134  {
135  return $this->type;
136  }
137 
144  public function getModifiedBy()
145  {
146  return $this->modifiedBy instanceof ModifiedByBuilder ? $this->modifiedBy->build() : $this->modifiedBy;
147  }
148 
155  public function getModifiedAt()
156  {
157  return $this->modifiedAt;
158  }
159 
166  public function getLabel()
167  {
168  return $this->label instanceof LabelBuilder ? $this->label->build() : $this->label;
169  }
170 
177  public function getPreviousLabel()
178  {
179  return $this->previousLabel instanceof LabelBuilder ? $this->previousLabel->build() : $this->previousLabel;
180  }
181 
189  public function getChanges()
190  {
191  return $this->changes;
192  }
193 
200  public function getResource()
201  {
202  return $this->resource instanceof ResourceIdentifierBuilder ? $this->resource->build() : $this->resource;
203  }
204 
211  public function getStores()
212  {
213  return $this->stores;
214  }
215 
222  public function getBusinessUnit()
223  {
224  return $this->businessUnit instanceof KeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit;
225  }
226 
234  public function getWithoutChanges()
235  {
236  return $this->withoutChanges;
237  }
238 
243  public function withVersion(?int $version)
244  {
245  $this->version = $version;
246 
247  return $this;
248  }
249 
254  public function withPreviousVersion(?int $previousVersion)
255  {
256  $this->previousVersion = $previousVersion;
257 
258  return $this;
259  }
260 
265  public function withType(?string $type)
266  {
267  $this->type = $type;
268 
269  return $this;
270  }
271 
276  public function withModifiedBy(?ModifiedBy $modifiedBy)
277  {
278  $this->modifiedBy = $modifiedBy;
279 
280  return $this;
281  }
282 
287  public function withModifiedAt(?string $modifiedAt)
288  {
289  $this->modifiedAt = $modifiedAt;
290 
291  return $this;
292  }
293 
298  public function withLabel(?Label $label)
299  {
300  $this->label = $label;
301 
302  return $this;
303  }
304 
309  public function withPreviousLabel(?Label $previousLabel)
310  {
311  $this->previousLabel = $previousLabel;
312 
313  return $this;
314  }
315 
320  public function withChanges(?ChangeCollection $changes)
321  {
322  $this->changes = $changes;
323 
324  return $this;
325  }
326 
331  public function withResource(?ResourceIdentifier $resource)
332  {
333  $this->resource = $resource;
334 
335  return $this;
336  }
337 
342  public function withStores(?KeyReferenceCollection $stores)
343  {
344  $this->stores = $stores;
345 
346  return $this;
347  }
348 
353  public function withBusinessUnit(?KeyReference $businessUnit)
354  {
355  $this->businessUnit = $businessUnit;
356 
357  return $this;
358  }
359 
364  public function withWithoutChanges(?bool $withoutChanges)
365  {
366  $this->withoutChanges = $withoutChanges;
367 
368  return $this;
369  }
370 
375  public function withModifiedByBuilder(?ModifiedByBuilder $modifiedBy)
376  {
377  $this->modifiedBy = $modifiedBy;
378 
379  return $this;
380  }
381 
386  public function withLabelBuilder(?LabelBuilder $label)
387  {
388  $this->label = $label;
389 
390  return $this;
391  }
392 
397  public function withPreviousLabelBuilder(?LabelBuilder $previousLabel)
398  {
399  $this->previousLabel = $previousLabel;
400 
401  return $this;
402  }
403 
408  public function withResourceBuilder(?ResourceIdentifierBuilder $resource)
409  {
410  $this->resource = $resource;
411 
412  return $this;
413  }
414 
419  public function withBusinessUnitBuilder(?KeyReferenceBuilder $businessUnit)
420  {
421  $this->businessUnit = $businessUnit;
422 
423  return $this;
424  }
425 
426  public function build(): Record
427  {
428  return new RecordModel(
429  $this->version,
430  $this->previousVersion,
431  $this->type,
432  $this->modifiedBy instanceof ModifiedByBuilder ? $this->modifiedBy->build() : $this->modifiedBy,
433  $this->modifiedAt,
434  $this->label instanceof LabelBuilder ? $this->label->build() : $this->label,
435  $this->previousLabel instanceof LabelBuilder ? $this->previousLabel->build() : $this->previousLabel,
436  $this->changes,
437  $this->resource instanceof ResourceIdentifierBuilder ? $this->resource->build() : $this->resource,
438  $this->stores,
439  $this->businessUnit instanceof KeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit,
440  $this->withoutChanges
441  );
442  }
443 
444  public static function of(): RecordBuilder
445  {
446  return new self();
447  }
448 }
withResourceBuilder(?ResourceIdentifierBuilder $resource)
withBusinessUnitBuilder(?KeyReferenceBuilder $businessUnit)