commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
PriceTierBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class PriceTierBuilder implements Builder
22 {
27  private $minimumQuantity;
28 
33  private $value;
34 
41  public function getMinimumQuantity()
42  {
43  return $this->minimumQuantity;
44  }
45 
52  public function getValue()
53  {
54  return $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value;
55  }
56 
61  public function withMinimumQuantity(?int $minimumQuantity)
62  {
63  $this->minimumQuantity = $minimumQuantity;
64 
65  return $this;
66  }
67 
72  public function withValue(?TypedMoney $value)
73  {
74  $this->value = $value;
75 
76  return $this;
77  }
78 
83  public function withValueBuilder(?TypedMoneyBuilder $value)
84  {
85  $this->value = $value;
86 
87  return $this;
88  }
89 
90  public function build(): PriceTier
91  {
92  return new PriceTierModel(
93  $this->minimumQuantity,
94  $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value
95  );
96  }
97 
98  public static function of(): PriceTierBuilder
99  {
100  return new self();
101  }
102 }