commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ChannelDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
24 use stdClass;
25 
29 final class ChannelDraftBuilder implements Builder
30 {
35  private $key;
36 
41  private $roles;
42 
47  private $name;
48 
53  private $description;
54 
59  private $address;
60 
65  private $custom;
66 
71  private $geoLocation;
72 
79  public function getKey()
80  {
81  return $this->key;
82  }
83 
92  public function getRoles()
93  {
94  return $this->roles;
95  }
96 
103  public function getName()
104  {
105  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
106  }
107 
114  public function getDescription()
115  {
116  return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
117  }
118 
125  public function getAddress()
126  {
127  return $this->address instanceof BaseAddressBuilder ? $this->address->build() : $this->address;
128  }
129 
136  public function getCustom()
137  {
138  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
139  }
140 
148  public function getGeoLocation()
149  {
150  return $this->geoLocation instanceof GeoJsonBuilder ? $this->geoLocation->build() : $this->geoLocation;
151  }
152 
157  public function withKey(?string $key)
158  {
159  $this->key = $key;
160 
161  return $this;
162  }
163 
168  public function withRoles(?array $roles)
169  {
170  $this->roles = $roles;
171 
172  return $this;
173  }
174 
179  public function withName(?LocalizedString $name)
180  {
181  $this->name = $name;
182 
183  return $this;
184  }
185 
190  public function withDescription(?LocalizedString $description)
191  {
192  $this->description = $description;
193 
194  return $this;
195  }
196 
201  public function withAddress(?BaseAddress $address)
202  {
203  $this->address = $address;
204 
205  return $this;
206  }
207 
212  public function withCustom(?CustomFieldsDraft $custom)
213  {
214  $this->custom = $custom;
215 
216  return $this;
217  }
218 
223  public function withGeoLocation(?GeoJson $geoLocation)
224  {
225  $this->geoLocation = $geoLocation;
226 
227  return $this;
228  }
229 
234  public function withNameBuilder(?LocalizedStringBuilder $name)
235  {
236  $this->name = $name;
237 
238  return $this;
239  }
240 
245  public function withDescriptionBuilder(?LocalizedStringBuilder $description)
246  {
247  $this->description = $description;
248 
249  return $this;
250  }
251 
256  public function withAddressBuilder(?BaseAddressBuilder $address)
257  {
258  $this->address = $address;
259 
260  return $this;
261  }
262 
267  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
268  {
269  $this->custom = $custom;
270 
271  return $this;
272  }
273 
278  public function withGeoLocationBuilder(?GeoJsonBuilder $geoLocation)
279  {
280  $this->geoLocation = $geoLocation;
281 
282  return $this;
283  }
284 
285  public function build(): ChannelDraft
286  {
287  return new ChannelDraftModel(
288  $this->key,
289  $this->roles,
290  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
291  $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
292  $this->address instanceof BaseAddressBuilder ? $this->address->build() : $this->address,
293  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
294  $this->geoLocation instanceof GeoJsonBuilder ? $this->geoLocation->build() : $this->geoLocation
295  );
296  }
297 
298  public static function of(): ChannelDraftBuilder
299  {
300  return new self();
301  }
302 }
withDescriptionBuilder(?LocalizedStringBuilder $description)