commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
StandalonePriceImportBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
29 use DateTimeImmutable;
30 use stdClass;
31 
35 final class StandalonePriceImportBuilder implements Builder
36 {
41  private $key;
42 
47  private $sku;
48 
53  private $value;
54 
59  private $country;
60 
65  private $customerGroup;
66 
71  private $channel;
72 
77  private $validFrom;
78 
83  private $validUntil;
84 
89  private $tiers;
90 
95  private $discounted;
96 
101  private $custom;
102 
109  public function getKey()
110  {
111  return $this->key;
112  }
113 
120  public function getSku()
121  {
122  return $this->sku;
123  }
124 
131  public function getValue()
132  {
133  return $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value;
134  }
135 
142  public function getCountry()
143  {
144  return $this->country;
145  }
146 
153  public function getCustomerGroup()
154  {
155  return $this->customerGroup instanceof CustomerGroupKeyReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup;
156  }
157 
164  public function getChannel()
165  {
166  return $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel;
167  }
168 
175  public function getValidFrom()
176  {
177  return $this->validFrom;
178  }
179 
186  public function getValidUntil()
187  {
188  return $this->validUntil;
189  }
190 
197  public function getTiers()
198  {
199  return $this->tiers;
200  }
201 
208  public function getDiscounted()
209  {
210  return $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted;
211  }
212 
219  public function getCustom()
220  {
221  return $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom;
222  }
223 
228  public function withKey(?string $key)
229  {
230  $this->key = $key;
231 
232  return $this;
233  }
234 
239  public function withSku(?string $sku)
240  {
241  $this->sku = $sku;
242 
243  return $this;
244  }
245 
250  public function withValue(?TypedMoney $value)
251  {
252  $this->value = $value;
253 
254  return $this;
255  }
256 
261  public function withCountry(?string $country)
262  {
263  $this->country = $country;
264 
265  return $this;
266  }
267 
272  public function withCustomerGroup(?CustomerGroupKeyReference $customerGroup)
273  {
274  $this->customerGroup = $customerGroup;
275 
276  return $this;
277  }
278 
283  public function withChannel(?ChannelKeyReference $channel)
284  {
285  $this->channel = $channel;
286 
287  return $this;
288  }
289 
294  public function withValidFrom(?DateTimeImmutable $validFrom)
295  {
296  $this->validFrom = $validFrom;
297 
298  return $this;
299  }
300 
305  public function withValidUntil(?DateTimeImmutable $validUntil)
306  {
307  $this->validUntil = $validUntil;
308 
309  return $this;
310  }
311 
316  public function withTiers(?PriceTierCollection $tiers)
317  {
318  $this->tiers = $tiers;
319 
320  return $this;
321  }
322 
327  public function withDiscounted(?DiscountedPrice $discounted)
328  {
329  $this->discounted = $discounted;
330 
331  return $this;
332  }
333 
338  public function withCustom(?Custom $custom)
339  {
340  $this->custom = $custom;
341 
342  return $this;
343  }
344 
349  public function withValueBuilder(?TypedMoneyBuilder $value)
350  {
351  $this->value = $value;
352 
353  return $this;
354  }
355 
361  {
362  $this->customerGroup = $customerGroup;
363 
364  return $this;
365  }
366 
372  {
373  $this->channel = $channel;
374 
375  return $this;
376  }
377 
382  public function withDiscountedBuilder(?DiscountedPriceBuilder $discounted)
383  {
384  $this->discounted = $discounted;
385 
386  return $this;
387  }
388 
393  public function withCustomBuilder(?CustomBuilder $custom)
394  {
395  $this->custom = $custom;
396 
397  return $this;
398  }
399 
400  public function build(): StandalonePriceImport
401  {
402  return new StandalonePriceImportModel(
403  $this->key,
404  $this->sku,
405  $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value,
406  $this->country,
407  $this->customerGroup instanceof CustomerGroupKeyReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup,
408  $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel,
409  $this->validFrom,
410  $this->validUntil,
411  $this->tiers,
412  $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted,
413  $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom
414  );
415  }
416 
417  public static function of(): StandalonePriceImportBuilder
418  {
419  return new self();
420  }
421 }