commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ZoneBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
22 use DateTimeImmutable;
23 use stdClass;
24 
28 final class ZoneBuilder 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 $name;
77 
82  private $description;
83 
88  private $locations;
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 getName()
174  {
175  return $this->name;
176  }
177 
184  public function getDescription()
185  {
186  return $this->description;
187  }
188 
195  public function getLocations()
196  {
197  return $this->locations;
198  }
199 
204  public function withId(?string $id)
205  {
206  $this->id = $id;
207 
208  return $this;
209  }
210 
215  public function withVersion(?int $version)
216  {
217  $this->version = $version;
218 
219  return $this;
220  }
221 
226  public function withCreatedAt(?DateTimeImmutable $createdAt)
227  {
228  $this->createdAt = $createdAt;
229 
230  return $this;
231  }
232 
237  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
238  {
239  $this->lastModifiedAt = $lastModifiedAt;
240 
241  return $this;
242  }
243 
248  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
249  {
250  $this->lastModifiedBy = $lastModifiedBy;
251 
252  return $this;
253  }
254 
259  public function withCreatedBy(?CreatedBy $createdBy)
260  {
261  $this->createdBy = $createdBy;
262 
263  return $this;
264  }
265 
270  public function withKey(?string $key)
271  {
272  $this->key = $key;
273 
274  return $this;
275  }
276 
281  public function withName(?string $name)
282  {
283  $this->name = $name;
284 
285  return $this;
286  }
287 
292  public function withDescription(?string $description)
293  {
294  $this->description = $description;
295 
296  return $this;
297  }
298 
303  public function withLocations(?LocationCollection $locations)
304  {
305  $this->locations = $locations;
306 
307  return $this;
308  }
309 
314  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
315  {
316  $this->lastModifiedBy = $lastModifiedBy;
317 
318  return $this;
319  }
320 
325  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
326  {
327  $this->createdBy = $createdBy;
328 
329  return $this;
330  }
331 
332  public function build(): Zone
333  {
334  return new ZoneModel(
335  $this->id,
336  $this->version,
337  $this->createdAt,
338  $this->lastModifiedAt,
339  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
340  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
341  $this->key,
342  $this->name,
343  $this->description,
344  $this->locations
345  );
346  }
347 
348  public static function of(): ZoneBuilder
349  {
350  return new self();
351  }
352 }
withLocations(?LocationCollection $locations)
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
withCreatedAt(?DateTimeImmutable $createdAt)
withCreatedByBuilder(?CreatedByBuilder $createdBy)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)