commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
AttributeDefinitionModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
28  protected $type;
29 
34  protected $name;
35 
40  protected $label;
41 
46  protected $isRequired;
47 
53 
58  protected $inputTip;
59 
64  protected $inputHint;
65 
70  protected $isSearchable;
71 
72 
76  public function __construct(
77  ?AttributeType $type = null,
78  ?string $name = null,
79  ?LocalizedString $label = null,
80  ?bool $isRequired = null,
81  ?string $attributeConstraint = null,
82  ?LocalizedString $inputTip = null,
83  ?string $inputHint = null,
84  ?bool $isSearchable = null
85  ) {
86  $this->type = $type;
87  $this->name = $name;
88  $this->label = $label;
89  $this->isRequired = $isRequired;
90  $this->attributeConstraint = $attributeConstraint;
91  $this->inputTip = $inputTip;
92  $this->inputHint = $inputHint;
93  $this->isSearchable = $isSearchable;
94  }
95 
100  public function getType()
101  {
102  if (is_null($this->type)) {
104  $data = $this->raw(self::FIELD_TYPE);
105  if (is_null($data)) {
106  return null;
107  }
108 
109  $this->type = AttributeTypeModel::of($data);
110  }
111 
112  return $this->type;
113  }
114 
119  public function getName()
120  {
121  if (is_null($this->name)) {
123  $data = $this->raw(self::FIELD_NAME);
124  if (is_null($data)) {
125  return null;
126  }
127  $this->name = (string) $data;
128  }
129 
130  return $this->name;
131  }
132 
144  public function getLabel()
145  {
146  if (is_null($this->label)) {
148  $data = $this->raw(self::FIELD_LABEL);
149  if (is_null($data)) {
150  return null;
151  }
152 
153  $this->label = LocalizedStringModel::of($data);
154  }
155 
156  return $this->label;
157  }
158 
163  public function getIsRequired()
164  {
165  if (is_null($this->isRequired)) {
167  $data = $this->raw(self::FIELD_IS_REQUIRED);
168  if (is_null($data)) {
169  return null;
170  }
171  $this->isRequired = (bool) $data;
172  }
173 
174  return $this->isRequired;
175  }
176 
181  public function getAttributeConstraint()
182  {
183  if (is_null($this->attributeConstraint)) {
185  $data = $this->raw(self::FIELD_ATTRIBUTE_CONSTRAINT);
186  if (is_null($data)) {
187  return null;
188  }
189  $this->attributeConstraint = (string) $data;
190  }
191 
193  }
194 
206  public function getInputTip()
207  {
208  if (is_null($this->inputTip)) {
210  $data = $this->raw(self::FIELD_INPUT_TIP);
211  if (is_null($data)) {
212  return null;
213  }
214 
215  $this->inputTip = LocalizedStringModel::of($data);
216  }
217 
218  return $this->inputTip;
219  }
220 
225  public function getInputHint()
226  {
227  if (is_null($this->inputHint)) {
229  $data = $this->raw(self::FIELD_INPUT_HINT);
230  if (is_null($data)) {
231  return null;
232  }
233  $this->inputHint = (string) $data;
234  }
235 
236  return $this->inputHint;
237  }
238 
243  public function getIsSearchable()
244  {
245  if (is_null($this->isSearchable)) {
247  $data = $this->raw(self::FIELD_IS_SEARCHABLE);
248  if (is_null($data)) {
249  return null;
250  }
251  $this->isSearchable = (bool) $data;
252  }
253 
254  return $this->isSearchable;
255  }
256 
257 
261  public function setType(?AttributeType $type): void
262  {
263  $this->type = $type;
264  }
265 
269  public function setName(?string $name): void
270  {
271  $this->name = $name;
272  }
273 
277  public function setLabel(?LocalizedString $label): void
278  {
279  $this->label = $label;
280  }
281 
285  public function setIsRequired(?bool $isRequired): void
286  {
287  $this->isRequired = $isRequired;
288  }
289 
293  public function setAttributeConstraint(?string $attributeConstraint): void
294  {
295  $this->attributeConstraint = $attributeConstraint;
296  }
297 
301  public function setInputTip(?LocalizedString $inputTip): void
302  {
303  $this->inputTip = $inputTip;
304  }
305 
309  public function setInputHint(?string $inputHint): void
310  {
311  $this->inputHint = $inputHint;
312  }
313 
317  public function setIsSearchable(?bool $isSearchable): void
318  {
319  $this->isSearchable = $isSearchable;
320  }
321 }
static of($data=null)
Definition: MapperMap.php:45
__construct(?AttributeType $type=null, ?string $name=null, ?LocalizedString $label=null, ?bool $isRequired=null, ?string $attributeConstraint=null, ?LocalizedString $inputTip=null, ?string $inputHint=null, ?bool $isSearchable=null)