commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
AssetDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
22 final class AssetDraftModel extends JsonObjectModel implements AssetDraft
23 {
28  protected $sources;
29 
34  protected $name;
35 
40  protected $description;
41 
46  protected $tags;
47 
52  protected $custom;
53 
58  protected $key;
59 
60 
64  public function __construct(
66  ?LocalizedString $name = null,
68  ?array $tags = null,
69  ?CustomFieldsDraft $custom = null,
70  ?string $key = null
71  ) {
72  $this->sources = $sources;
73  $this->name = $name;
74  $this->description = $description;
75  $this->tags = $tags;
76  $this->custom = $custom;
77  $this->key = $key;
78  }
79 
84  public function getSources()
85  {
86  if (is_null($this->sources)) {
88  $data = $this->raw(self::FIELD_SOURCES);
89  if (is_null($data)) {
90  return null;
91  }
92  $this->sources = AssetSourceCollection::fromArray($data);
93  }
94 
95  return $this->sources;
96  }
97 
104  public function getName()
105  {
106  if (is_null($this->name)) {
108  $data = $this->raw(self::FIELD_NAME);
109  if (is_null($data)) {
110  return null;
111  }
112 
113  $this->name = LocalizedStringModel::of($data);
114  }
115 
116  return $this->name;
117  }
118 
125  public function getDescription()
126  {
127  if (is_null($this->description)) {
129  $data = $this->raw(self::FIELD_DESCRIPTION);
130  if (is_null($data)) {
131  return null;
132  }
133 
134  $this->description = LocalizedStringModel::of($data);
135  }
136 
137  return $this->description;
138  }
139 
146  public function getTags()
147  {
148  if (is_null($this->tags)) {
150  $data = $this->raw(self::FIELD_TAGS);
151  if (is_null($data)) {
152  return null;
153  }
154  $this->tags = $data;
155  }
156 
157  return $this->tags;
158  }
159 
166  public function getCustom()
167  {
168  if (is_null($this->custom)) {
170  $data = $this->raw(self::FIELD_CUSTOM);
171  if (is_null($data)) {
172  return null;
173  }
174 
175  $this->custom = CustomFieldsDraftModel::of($data);
176  }
177 
178  return $this->custom;
179  }
180 
187  public function getKey()
188  {
189  if (is_null($this->key)) {
191  $data = $this->raw(self::FIELD_KEY);
192  if (is_null($data)) {
193  return null;
194  }
195  $this->key = (string) $data;
196  }
197 
198  return $this->key;
199  }
200 
201 
205  public function setSources(?AssetSourceCollection $sources): void
206  {
207  $this->sources = $sources;
208  }
209 
213  public function setName(?LocalizedString $name): void
214  {
215  $this->name = $name;
216  }
217 
222  {
223  $this->description = $description;
224  }
225 
229  public function setTags(?array $tags): void
230  {
231  $this->tags = $tags;
232  }
233 
237  public function setCustom(?CustomFieldsDraft $custom): void
238  {
239  $this->custom = $custom;
240  }
241 
245  public function setKey(?string $key): void
246  {
247  $this->key = $key;
248  }
249 }
__construct(?AssetSourceCollection $sources=null, ?LocalizedString $name=null, ?LocalizedString $description=null, ?array $tags=null, ?CustomFieldsDraft $custom=null, ?string $key=null)
setSources(?AssetSourceCollection $sources)
setDescription(?LocalizedString $description)
static of($data=null)
Definition: MapperMap.php:45