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