commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
AttributeDefinitionDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
24 {
29  private $type;
30 
35  private $name;
36 
41  private $label;
42 
47  private $isRequired;
48 
53  private $attributeConstraint;
54 
59  private $inputTip;
60 
65  private $inputHint;
66 
71  private $isSearchable;
72 
80  public function getType()
81  {
82  return $this->type instanceof AttributeTypeBuilder ? $this->type->build() : $this->type;
83  }
84 
93  public function getName()
94  {
95  return $this->name;
96  }
97 
104  public function getLabel()
105  {
106  return $this->label instanceof LocalizedStringBuilder ? $this->label->build() : $this->label;
107  }
108 
115  public function getIsRequired()
116  {
117  return $this->isRequired;
118  }
119 
126  public function getAttributeConstraint()
127  {
128  return $this->attributeConstraint;
129  }
130 
137  public function getInputTip()
138  {
139  return $this->inputTip instanceof LocalizedStringBuilder ? $this->inputTip->build() : $this->inputTip;
140  }
141 
148  public function getInputHint()
149  {
150  return $this->inputHint;
151  }
152 
163  public function getIsSearchable()
164  {
165  return $this->isSearchable;
166  }
167 
172  public function withType(?AttributeType $type)
173  {
174  $this->type = $type;
175 
176  return $this;
177  }
178 
183  public function withName(?string $name)
184  {
185  $this->name = $name;
186 
187  return $this;
188  }
189 
194  public function withLabel(?LocalizedString $label)
195  {
196  $this->label = $label;
197 
198  return $this;
199  }
200 
205  public function withIsRequired(?bool $isRequired)
206  {
207  $this->isRequired = $isRequired;
208 
209  return $this;
210  }
211 
216  public function withAttributeConstraint(?string $attributeConstraint)
217  {
218  $this->attributeConstraint = $attributeConstraint;
219 
220  return $this;
221  }
222 
227  public function withInputTip(?LocalizedString $inputTip)
228  {
229  $this->inputTip = $inputTip;
230 
231  return $this;
232  }
233 
238  public function withInputHint(?string $inputHint)
239  {
240  $this->inputHint = $inputHint;
241 
242  return $this;
243  }
244 
249  public function withIsSearchable(?bool $isSearchable)
250  {
251  $this->isSearchable = $isSearchable;
252 
253  return $this;
254  }
255 
260  public function withTypeBuilder(?AttributeTypeBuilder $type)
261  {
262  $this->type = $type;
263 
264  return $this;
265  }
266 
271  public function withLabelBuilder(?LocalizedStringBuilder $label)
272  {
273  $this->label = $label;
274 
275  return $this;
276  }
277 
282  public function withInputTipBuilder(?LocalizedStringBuilder $inputTip)
283  {
284  $this->inputTip = $inputTip;
285 
286  return $this;
287  }
288 
289  public function build(): AttributeDefinitionDraft
290  {
292  $this->type instanceof AttributeTypeBuilder ? $this->type->build() : $this->type,
293  $this->name,
294  $this->label instanceof LocalizedStringBuilder ? $this->label->build() : $this->label,
295  $this->isRequired,
296  $this->attributeConstraint,
297  $this->inputTip instanceof LocalizedStringBuilder ? $this->inputTip->build() : $this->inputTip,
298  $this->inputHint,
299  $this->isSearchable
300  );
301  }
302 
303  public static function of(): AttributeDefinitionDraftBuilder
304  {
305  return new self();
306  }
307 }