commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
AssetBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
23 final class AssetBuilder implements Builder
24 {
29  private $key;
30 
35  private $sources;
36 
41  private $name;
42 
47  private $description;
48 
53  private $tags;
54 
59  private $custom;
60 
68  public function getKey()
69  {
70  return $this->key;
71  }
72 
77  public function getSources()
78  {
79  return $this->sources;
80  }
81 
93  public function getName()
94  {
95  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
96  }
97 
109  public function getDescription()
110  {
111  return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
112  }
113 
118  public function getTags()
119  {
120  return $this->tags;
121  }
122 
129  public function getCustom()
130  {
131  return $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom;
132  }
133 
138  public function withKey(?string $key)
139  {
140  $this->key = $key;
141 
142  return $this;
143  }
144 
149  public function withSources(?AssetSourceCollection $sources)
150  {
151  $this->sources = $sources;
152 
153  return $this;
154  }
155 
160  public function withName(?LocalizedString $name)
161  {
162  $this->name = $name;
163 
164  return $this;
165  }
166 
171  public function withDescription(?LocalizedString $description)
172  {
173  $this->description = $description;
174 
175  return $this;
176  }
177 
182  public function withTags(?array $tags)
183  {
184  $this->tags = $tags;
185 
186  return $this;
187  }
188 
193  public function withCustom(?Custom $custom)
194  {
195  $this->custom = $custom;
196 
197  return $this;
198  }
199 
204  public function withNameBuilder(?LocalizedStringBuilder $name)
205  {
206  $this->name = $name;
207 
208  return $this;
209  }
210 
215  public function withDescriptionBuilder(?LocalizedStringBuilder $description)
216  {
217  $this->description = $description;
218 
219  return $this;
220  }
221 
226  public function withCustomBuilder(?CustomBuilder $custom)
227  {
228  $this->custom = $custom;
229 
230  return $this;
231  }
232 
233  public function build(): Asset
234  {
235  return new AssetModel(
236  $this->key,
237  $this->sources,
238  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
239  $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
240  $this->tags,
241  $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom
242  );
243  }
244 
245  public static function of(): AssetBuilder
246  {
247  return new self();
248  }
249 }
withSources(?AssetSourceCollection $sources)
withNameBuilder(?LocalizedStringBuilder $name)
withDescriptionBuilder(?LocalizedStringBuilder $description)
withDescription(?LocalizedString $description)