commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
LocalizableTextAttributeModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
24  public const DISCRIMINATOR_VALUE = 'ltext';
29  protected $name;
30 
35  protected $type;
36 
41  protected $value;
42 
43 
47  public function __construct(
48  ?string $name = null,
49  ?LocalizedString $value = null,
50  ?string $type = null
51  ) {
52  $this->name = $name;
53  $this->value = $value;
54  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
55  }
56 
65  public function getName()
66  {
67  if (is_null($this->name)) {
69  $data = $this->raw(self::FIELD_NAME);
70  if (is_null($data)) {
71  return null;
72  }
73  $this->name = (string) $data;
74  }
75 
76  return $this->name;
77  }
78 
83  public function getType()
84  {
85  if (is_null($this->type)) {
87  $data = $this->raw(self::FIELD_TYPE);
88  if (is_null($data)) {
89  return null;
90  }
91  $this->type = (string) $data;
92  }
93 
94  return $this->type;
95  }
96 
108  public function getValue()
109  {
110  if (is_null($this->value)) {
112  $data = $this->raw(self::FIELD_VALUE);
113  if (is_null($data)) {
114  return null;
115  }
116 
117  $this->value = LocalizedStringModel::of($data);
118  }
119 
120  return $this->value;
121  }
122 
123 
127  public function setName(?string $name): void
128  {
129  $this->name = $name;
130  }
131 
135  public function setValue(?LocalizedString $value): void
136  {
137  $this->value = $value;
138  }
139 }
static of($data=null)
Definition: MapperMap.php:45
__construct(?string $name=null, ?LocalizedString $value=null, ?string $type=null)