commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
TypeImportBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
20 use stdClass;
21 
25 final class TypeImportBuilder implements Builder
26 {
31  private $key;
32 
37  private $name;
38 
43  private $description;
44 
49  private $resourceTypeIds;
50 
55  private $fieldDefinitions;
56 
63  public function getKey()
64  {
65  return $this->key;
66  }
67 
74  public function getName()
75  {
76  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
77  }
78 
85  public function getDescription()
86  {
87  return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
88  }
89 
96  public function getResourceTypeIds()
97  {
98  return $this->resourceTypeIds;
99  }
100 
107  public function getFieldDefinitions()
108  {
109  return $this->fieldDefinitions;
110  }
111 
116  public function withKey(?string $key)
117  {
118  $this->key = $key;
119 
120  return $this;
121  }
122 
127  public function withName(?LocalizedString $name)
128  {
129  $this->name = $name;
130 
131  return $this;
132  }
133 
138  public function withDescription(?LocalizedString $description)
139  {
140  $this->description = $description;
141 
142  return $this;
143  }
144 
149  public function withResourceTypeIds(?array $resourceTypeIds)
150  {
151  $this->resourceTypeIds = $resourceTypeIds;
152 
153  return $this;
154  }
155 
160  public function withFieldDefinitions(?FieldDefinitionCollection $fieldDefinitions)
161  {
162  $this->fieldDefinitions = $fieldDefinitions;
163 
164  return $this;
165  }
166 
171  public function withNameBuilder(?LocalizedStringBuilder $name)
172  {
173  $this->name = $name;
174 
175  return $this;
176  }
177 
182  public function withDescriptionBuilder(?LocalizedStringBuilder $description)
183  {
184  $this->description = $description;
185 
186  return $this;
187  }
188 
189  public function build(): TypeImport
190  {
191  return new TypeImportModel(
192  $this->key,
193  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
194  $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
195  $this->resourceTypeIds,
196  $this->fieldDefinitions
197  );
198  }
199 
200  public static function of(): TypeImportBuilder
201  {
202  return new self();
203  }
204 }
withFieldDefinitions(?FieldDefinitionCollection $fieldDefinitions)
withDescriptionBuilder(?LocalizedStringBuilder $description)