commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
TaxedPriceModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
22 final class TaxedPriceModel extends JsonObjectModel implements TaxedPrice
23 {
28  protected $totalNet;
29 
34  protected $totalGross;
35 
40  protected $taxPortions;
41 
42 
46  public function __construct(
47  ?Money $totalNet = null,
48  ?Money $totalGross = null,
50  ) {
51  $this->totalNet = $totalNet;
52  $this->totalGross = $totalGross;
53  $this->taxPortions = $taxPortions;
54  }
55 
62  public function getTotalNet()
63  {
64  if (is_null($this->totalNet)) {
66  $data = $this->raw(self::FIELD_TOTAL_NET);
67  if (is_null($data)) {
68  return null;
69  }
70 
71  $this->totalNet = MoneyModel::of($data);
72  }
73 
74  return $this->totalNet;
75  }
76 
83  public function getTotalGross()
84  {
85  if (is_null($this->totalGross)) {
87  $data = $this->raw(self::FIELD_TOTAL_GROSS);
88  if (is_null($data)) {
89  return null;
90  }
91 
92  $this->totalGross = MoneyModel::of($data);
93  }
94 
95  return $this->totalGross;
96  }
97 
104  public function getTaxPortions()
105  {
106  if (is_null($this->taxPortions)) {
108  $data = $this->raw(self::FIELD_TAX_PORTIONS);
109  if (is_null($data)) {
110  return null;
111  }
112  $this->taxPortions = TaxPortionCollection::fromArray($data);
113  }
114 
115  return $this->taxPortions;
116  }
117 
118 
122  public function setTotalNet(?Money $totalNet): void
123  {
124  $this->totalNet = $totalNet;
125  }
126 
130  public function setTotalGross(?Money $totalGross): void
131  {
132  $this->totalGross = $totalGross;
133  }
134 
139  {
140  $this->taxPortions = $taxPortions;
141  }
142 }
__construct(?Money $totalNet=null, ?Money $totalGross=null, ?TaxPortionCollection $taxPortions=null)
setTaxPortions(?TaxPortionCollection $taxPortions)