commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
DiscountedTotalPricePortionBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
20 use stdClass;
21 
26 {
31  private $discount;
32 
37  private $discountedAmount;
38 
45  public function getDiscount()
46  {
47  return $this->discount instanceof CartDiscountReferenceBuilder ? $this->discount->build() : $this->discount;
48  }
49 
56  public function getDiscountedAmount()
57  {
58  return $this->discountedAmount instanceof TypedMoneyBuilder ? $this->discountedAmount->build() : $this->discountedAmount;
59  }
60 
65  public function withDiscount(?CartDiscountReference $discount)
66  {
67  $this->discount = $discount;
68 
69  return $this;
70  }
71 
76  public function withDiscountedAmount(?TypedMoney $discountedAmount)
77  {
78  $this->discountedAmount = $discountedAmount;
79 
80  return $this;
81  }
82 
88  {
89  $this->discount = $discount;
90 
91  return $this;
92  }
93 
98  public function withDiscountedAmountBuilder(?TypedMoneyBuilder $discountedAmount)
99  {
100  $this->discountedAmount = $discountedAmount;
101 
102  return $this;
103  }
104 
106  {
108  $this->discount instanceof CartDiscountReferenceBuilder ? $this->discount->build() : $this->discount,
109  $this->discountedAmount instanceof TypedMoneyBuilder ? $this->discountedAmount->build() : $this->discountedAmount
110  );
111  }
112 
113  public static function of(): DiscountedTotalPricePortionBuilder
114  {
115  return new self();
116  }
117 }