commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CustomerGroupBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
24 use DateTimeImmutable;
25 use stdClass;
26 
30 final class CustomerGroupBuilder 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 $key;
73 
78  private $name;
79 
84  private $custom;
85 
92  public function getId()
93  {
94  return $this->id;
95  }
96 
103  public function getVersion()
104  {
105  return $this->version;
106  }
107 
114  public function getCreatedAt()
115  {
116  return $this->createdAt;
117  }
118 
125  public function getLastModifiedAt()
126  {
127  return $this->lastModifiedAt;
128  }
129 
136  public function getLastModifiedBy()
137  {
138  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
139  }
140 
147  public function getCreatedBy()
148  {
149  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
150  }
151 
158  public function getKey()
159  {
160  return $this->key;
161  }
162 
169  public function getName()
170  {
171  return $this->name;
172  }
173 
180  public function getCustom()
181  {
182  return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
183  }
184 
189  public function withId(?string $id)
190  {
191  $this->id = $id;
192 
193  return $this;
194  }
195 
200  public function withVersion(?int $version)
201  {
202  $this->version = $version;
203 
204  return $this;
205  }
206 
211  public function withCreatedAt(?DateTimeImmutable $createdAt)
212  {
213  $this->createdAt = $createdAt;
214 
215  return $this;
216  }
217 
222  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
223  {
224  $this->lastModifiedAt = $lastModifiedAt;
225 
226  return $this;
227  }
228 
233  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
234  {
235  $this->lastModifiedBy = $lastModifiedBy;
236 
237  return $this;
238  }
239 
244  public function withCreatedBy(?CreatedBy $createdBy)
245  {
246  $this->createdBy = $createdBy;
247 
248  return $this;
249  }
250 
255  public function withKey(?string $key)
256  {
257  $this->key = $key;
258 
259  return $this;
260  }
261 
266  public function withName(?string $name)
267  {
268  $this->name = $name;
269 
270  return $this;
271  }
272 
277  public function withCustom(?CustomFields $custom)
278  {
279  $this->custom = $custom;
280 
281  return $this;
282  }
283 
288  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
289  {
290  $this->lastModifiedBy = $lastModifiedBy;
291 
292  return $this;
293  }
294 
299  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
300  {
301  $this->createdBy = $createdBy;
302 
303  return $this;
304  }
305 
310  public function withCustomBuilder(?CustomFieldsBuilder $custom)
311  {
312  $this->custom = $custom;
313 
314  return $this;
315  }
316 
317  public function build(): CustomerGroup
318  {
319  return new CustomerGroupModel(
320  $this->id,
321  $this->version,
322  $this->createdAt,
323  $this->lastModifiedAt,
324  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
325  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
326  $this->key,
327  $this->name,
328  $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom
329  );
330  }
331 
332  public static function of(): CustomerGroupBuilder
333  {
334  return new self();
335  }
336 }
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)