commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
AssetDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
18use stdClass;
19
23final class AssetDraftBuilder implements Builder
24{
29 private $sources;
30
35 private $name;
36
41 private $description;
42
47 private $tags;
48
53 private $custom;
54
59 private $key;
60
65 public function getSources()
66 {
67 return $this->sources;
68 }
69
76 public function getName()
77 {
78 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
79 }
80
87 public function getDescription()
88 {
89 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
90 }
91
98 public function getTags()
99 {
100 return $this->tags;
101 }
102
109 public function getCustom()
110 {
111 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
112 }
113
120 public function getKey()
121 {
122 return $this->key;
123 }
124
129 public function withSources(?AssetSourceCollection $sources)
130 {
131 $this->sources = $sources;
132
133 return $this;
134 }
135
140 public function withName(?LocalizedString $name)
141 {
142 $this->name = $name;
143
144 return $this;
145 }
146
151 public function withDescription(?LocalizedString $description)
152 {
153 $this->description = $description;
154
155 return $this;
156 }
157
162 public function withTags(?array $tags)
163 {
164 $this->tags = $tags;
165
166 return $this;
167 }
168
173 public function withCustom(?CustomFieldsDraft $custom)
174 {
175 $this->custom = $custom;
176
177 return $this;
178 }
179
184 public function withKey(?string $key)
185 {
186 $this->key = $key;
187
188 return $this;
189 }
190
196 {
197 $this->name = $name;
198
199 return $this;
200 }
201
206 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
207 {
208 $this->description = $description;
209
210 return $this;
211 }
212
218 {
219 $this->custom = $custom;
220
221 return $this;
222 }
223
224 public function build(): AssetDraft
225 {
226 return new AssetDraftModel(
227 $this->sources,
228 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
229 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
230 $this->tags,
231 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
232 $this->key
233 );
234 }
235
236 public static function of(): AssetDraftBuilder
237 {
238 return new self();
239 }
240}
withCustomBuilder(?CustomFieldsDraftBuilder $custom)
withDescriptionBuilder(?LocalizedStringBuilder $description)