commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
AssociateRoleBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
24 use DateTimeImmutable;
25 use stdClass;
26 
30 final class AssociateRoleBuilder 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 $buyerAssignable;
79 
84  private $name;
85 
90  private $permissions;
91 
96  private $custom;
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 
170  public function getKey()
171  {
172  return $this->key;
173  }
174 
181  public function getBuyerAssignable()
182  {
183  return $this->buyerAssignable;
184  }
185 
192  public function getName()
193  {
194  return $this->name;
195  }
196 
203  public function getPermissions()
204  {
205  return $this->permissions;
206  }
207 
214  public function getCustom()
215  {
216  return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
217  }
218 
223  public function withId(?string $id)
224  {
225  $this->id = $id;
226 
227  return $this;
228  }
229 
234  public function withVersion(?int $version)
235  {
236  $this->version = $version;
237 
238  return $this;
239  }
240 
245  public function withCreatedAt(?DateTimeImmutable $createdAt)
246  {
247  $this->createdAt = $createdAt;
248 
249  return $this;
250  }
251 
256  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
257  {
258  $this->lastModifiedAt = $lastModifiedAt;
259 
260  return $this;
261  }
262 
267  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
268  {
269  $this->lastModifiedBy = $lastModifiedBy;
270 
271  return $this;
272  }
273 
278  public function withCreatedBy(?CreatedBy $createdBy)
279  {
280  $this->createdBy = $createdBy;
281 
282  return $this;
283  }
284 
289  public function withKey(?string $key)
290  {
291  $this->key = $key;
292 
293  return $this;
294  }
295 
300  public function withBuyerAssignable(?bool $buyerAssignable)
301  {
302  $this->buyerAssignable = $buyerAssignable;
303 
304  return $this;
305  }
306 
311  public function withName(?string $name)
312  {
313  $this->name = $name;
314 
315  return $this;
316  }
317 
322  public function withPermissions(?array $permissions)
323  {
324  $this->permissions = $permissions;
325 
326  return $this;
327  }
328 
333  public function withCustom(?CustomFields $custom)
334  {
335  $this->custom = $custom;
336 
337  return $this;
338  }
339 
344  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
345  {
346  $this->lastModifiedBy = $lastModifiedBy;
347 
348  return $this;
349  }
350 
355  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
356  {
357  $this->createdBy = $createdBy;
358 
359  return $this;
360  }
361 
366  public function withCustomBuilder(?CustomFieldsBuilder $custom)
367  {
368  $this->custom = $custom;
369 
370  return $this;
371  }
372 
373  public function build(): AssociateRole
374  {
375  return new AssociateRoleModel(
376  $this->id,
377  $this->version,
378  $this->createdAt,
379  $this->lastModifiedAt,
380  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
381  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
382  $this->key,
383  $this->buyerAssignable,
384  $this->name,
385  $this->permissions,
386  $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom
387  );
388  }
389 
390  public static function of(): AssociateRoleBuilder
391  {
392  return new self();
393  }
394 }
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)