commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
TaxedPriceBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
23 final class TaxedPriceBuilder implements Builder
24 {
29  private $totalNet;
30 
35  private $totalGross;
36 
41  private $taxPortions;
42 
49  public function getTotalNet()
50  {
51  return $this->totalNet instanceof MoneyBuilder ? $this->totalNet->build() : $this->totalNet;
52  }
53 
60  public function getTotalGross()
61  {
62  return $this->totalGross instanceof MoneyBuilder ? $this->totalGross->build() : $this->totalGross;
63  }
64 
71  public function getTaxPortions()
72  {
73  return $this->taxPortions;
74  }
75 
80  public function withTotalNet(?Money $totalNet)
81  {
82  $this->totalNet = $totalNet;
83 
84  return $this;
85  }
86 
91  public function withTotalGross(?Money $totalGross)
92  {
93  $this->totalGross = $totalGross;
94 
95  return $this;
96  }
97 
102  public function withTaxPortions(?TaxPortionCollection $taxPortions)
103  {
104  $this->taxPortions = $taxPortions;
105 
106  return $this;
107  }
108 
113  public function withTotalNetBuilder(?MoneyBuilder $totalNet)
114  {
115  $this->totalNet = $totalNet;
116 
117  return $this;
118  }
119 
124  public function withTotalGrossBuilder(?MoneyBuilder $totalGross)
125  {
126  $this->totalGross = $totalGross;
127 
128  return $this;
129  }
130 
131  public function build(): TaxedPrice
132  {
133  return new TaxedPriceModel(
134  $this->totalNet instanceof MoneyBuilder ? $this->totalNet->build() : $this->totalNet,
135  $this->totalGross instanceof MoneyBuilder ? $this->totalGross->build() : $this->totalGross,
136  $this->taxPortions
137  );
138  }
139 
140  public static function of(): TaxedPriceBuilder
141  {
142  return new self();
143  }
144 }
withTaxPortions(?TaxPortionCollection $taxPortions)