commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CustomFieldsDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class CustomFieldsDraftBuilder implements Builder
22 {
27  private $type;
28 
33  private $fields;
34 
41  public function getType()
42  {
43  return $this->type instanceof TypeResourceIdentifierBuilder ? $this->type->build() : $this->type;
44  }
45 
52  public function getFields()
53  {
54  return $this->fields instanceof FieldContainerBuilder ? $this->fields->build() : $this->fields;
55  }
56 
61  public function withType(?TypeResourceIdentifier $type)
62  {
63  $this->type = $type;
64 
65  return $this;
66  }
67 
72  public function withFields(?FieldContainer $fields)
73  {
74  $this->fields = $fields;
75 
76  return $this;
77  }
78 
84  {
85  $this->type = $type;
86 
87  return $this;
88  }
89 
94  public function withFieldsBuilder(?FieldContainerBuilder $fields)
95  {
96  $this->fields = $fields;
97 
98  return $this;
99  }
100 
101  public function build(): CustomFieldsDraft
102  {
103  return new CustomFieldsDraftModel(
104  $this->type instanceof TypeResourceIdentifierBuilder ? $this->type->build() : $this->type,
105  $this->fields instanceof FieldContainerBuilder ? $this->fields->build() : $this->fields
106  );
107  }
108 
109  public static function of(): CustomFieldsDraftBuilder
110  {
111  return new self();
112  }
113 }