commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
TaxedPriceDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
20use stdClass;
21
25final class TaxedPriceDraftBuilder implements Builder
26{
31 private $totalNet;
32
37 private $totalGross;
38
43 private $taxPortions;
44
49 private $totalTax;
50
57 public function getTotalNet()
58 {
59 return $this->totalNet instanceof MoneyBuilder ? $this->totalNet->build() : $this->totalNet;
60 }
61
68 public function getTotalGross()
69 {
70 return $this->totalGross instanceof MoneyBuilder ? $this->totalGross->build() : $this->totalGross;
71 }
72
80 public function getTaxPortions()
81 {
82 return $this->taxPortions;
83 }
84
91 public function getTotalTax()
92 {
93 return $this->totalTax instanceof TypedMoneyDraftBuilder ? $this->totalTax->build() : $this->totalTax;
94 }
95
100 public function withTotalNet(?Money $totalNet)
101 {
102 $this->totalNet = $totalNet;
103
104 return $this;
105 }
106
111 public function withTotalGross(?Money $totalGross)
112 {
113 $this->totalGross = $totalGross;
114
115 return $this;
116 }
117
122 public function withTaxPortions(?TaxPortionDraftCollection $taxPortions)
123 {
124 $this->taxPortions = $taxPortions;
125
126 return $this;
127 }
128
133 public function withTotalTax(?TypedMoneyDraft $totalTax)
134 {
135 $this->totalTax = $totalTax;
136
137 return $this;
138 }
139
144 public function withTotalNetBuilder(?MoneyBuilder $totalNet)
145 {
146 $this->totalNet = $totalNet;
147
148 return $this;
149 }
150
155 public function withTotalGrossBuilder(?MoneyBuilder $totalGross)
156 {
157 $this->totalGross = $totalGross;
158
159 return $this;
160 }
161
166 public function withTotalTaxBuilder(?TypedMoneyDraftBuilder $totalTax)
167 {
168 $this->totalTax = $totalTax;
169
170 return $this;
171 }
172
173 public function build(): TaxedPriceDraft
174 {
175 return new TaxedPriceDraftModel(
176 $this->totalNet instanceof MoneyBuilder ? $this->totalNet->build() : $this->totalNet,
177 $this->totalGross instanceof MoneyBuilder ? $this->totalGross->build() : $this->totalGross,
178 $this->taxPortions,
179 $this->totalTax instanceof TypedMoneyDraftBuilder ? $this->totalTax->build() : $this->totalTax
180 );
181 }
182
183 public static function of(): TaxedPriceDraftBuilder
184 {
185 return new self();
186 }
187}
withTaxPortions(?TaxPortionDraftCollection $taxPortions)