commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ExternalTaxAmountDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
23 final class ExternalTaxAmountDraftBuilder implements Builder
24 {
29  private $totalGross;
30 
35  private $taxRate;
36 
43  public function getTotalGross()
44  {
45  return $this->totalGross instanceof MoneyBuilder ? $this->totalGross->build() : $this->totalGross;
46  }
47 
54  public function getTaxRate()
55  {
56  return $this->taxRate instanceof ExternalTaxRateDraftBuilder ? $this->taxRate->build() : $this->taxRate;
57  }
58 
63  public function withTotalGross(?Money $totalGross)
64  {
65  $this->totalGross = $totalGross;
66 
67  return $this;
68  }
69 
74  public function withTaxRate(?ExternalTaxRateDraft $taxRate)
75  {
76  $this->taxRate = $taxRate;
77 
78  return $this;
79  }
80 
85  public function withTotalGrossBuilder(?MoneyBuilder $totalGross)
86  {
87  $this->totalGross = $totalGross;
88 
89  return $this;
90  }
91 
97  {
98  $this->taxRate = $taxRate;
99 
100  return $this;
101  }
102 
103  public function build(): ExternalTaxAmountDraft
104  {
105  return new ExternalTaxAmountDraftModel(
106  $this->totalGross instanceof MoneyBuilder ? $this->totalGross->build() : $this->totalGross,
107  $this->taxRate instanceof ExternalTaxRateDraftBuilder ? $this->taxRate->build() : $this->taxRate
108  );
109  }
110 
111  public static function of(): ExternalTaxAmountDraftBuilder
112  {
113  return new self();
114  }
115 }