commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
OrderExcerptModel.php
1<?php
2
3declare(strict_types=1);
10
19use stdClass;
20
24final class OrderExcerptModel extends JsonObjectModel implements OrderExcerpt
25{
30 protected $totalPrice;
31
36 protected $taxedPrice;
37
42 protected $version;
43
44
48 public function __construct(
49 ?TypedMoney $totalPrice = null,
50 ?TaxedPrice $taxedPrice = null,
51 ?int $version = null
52 ) {
53 $this->totalPrice = $totalPrice;
54 $this->taxedPrice = $taxedPrice;
55 $this->version = $version;
56 }
57
64 public function getTotalPrice()
65 {
66 if (is_null($this->totalPrice)) {
68 $data = $this->raw(self::FIELD_TOTAL_PRICE);
69 if (is_null($data)) {
70 return null;
71 }
72 $className = TypedMoneyModel::resolveDiscriminatorClass($data);
73 $this->totalPrice = $className::of($data);
74 }
75
76 return $this->totalPrice;
77 }
78
85 public function getTaxedPrice()
86 {
87 if (is_null($this->taxedPrice)) {
89 $data = $this->raw(self::FIELD_TAXED_PRICE);
90 if (is_null($data)) {
91 return null;
92 }
93
94 $this->taxedPrice = TaxedPriceModel::of($data);
95 }
96
97 return $this->taxedPrice;
98 }
99
106 public function getVersion()
107 {
108 if (is_null($this->version)) {
110 $data = $this->raw(self::FIELD_VERSION);
111 if (is_null($data)) {
112 return null;
113 }
114 $this->version = (int) $data;
115 }
116
117 return $this->version;
118 }
119
120
124 public function setTotalPrice(?TypedMoney $totalPrice): void
125 {
126 $this->totalPrice = $totalPrice;
127 }
128
132 public function setTaxedPrice(?TaxedPrice $taxedPrice): void
133 {
134 $this->taxedPrice = $taxedPrice;
135 }
136
140 public function setVersion(?int $version): void
141 {
142 $this->version = $version;
143 }
144}
__construct(?TypedMoney $totalPrice=null, ?TaxedPrice $taxedPrice=null, ?int $version=null)