commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ExternalLineItemTotalPriceBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
24 {
29  private $price;
30 
35  private $totalPrice;
36 
43  public function getPrice()
44  {
45  return $this->price instanceof MoneyBuilder ? $this->price->build() : $this->price;
46  }
47 
54  public function getTotalPrice()
55  {
56  return $this->totalPrice instanceof MoneyBuilder ? $this->totalPrice->build() : $this->totalPrice;
57  }
58 
63  public function withPrice(?Money $price)
64  {
65  $this->price = $price;
66 
67  return $this;
68  }
69 
74  public function withTotalPrice(?Money $totalPrice)
75  {
76  $this->totalPrice = $totalPrice;
77 
78  return $this;
79  }
80 
85  public function withPriceBuilder(?MoneyBuilder $price)
86  {
87  $this->price = $price;
88 
89  return $this;
90  }
91 
96  public function withTotalPriceBuilder(?MoneyBuilder $totalPrice)
97  {
98  $this->totalPrice = $totalPrice;
99 
100  return $this;
101  }
102 
104  {
106  $this->price instanceof MoneyBuilder ? $this->price->build() : $this->price,
107  $this->totalPrice instanceof MoneyBuilder ? $this->totalPrice->build() : $this->totalPrice
108  );
109  }
110 
111  public static function of(): ExternalLineItemTotalPriceBuilder
112  {
113  return new self();
114  }
115 }