commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
OrderExcerptBuilder.php
1<?php
2
3declare(strict_types=1);
10
20use stdClass;
21
25final class OrderExcerptBuilder implements Builder
26{
31 private $totalPrice;
32
37 private $taxedPrice;
38
43 private $version;
44
51 public function getTotalPrice()
52 {
53 return $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice;
54 }
55
62 public function getTaxedPrice()
63 {
64 return $this->taxedPrice instanceof TaxedPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice;
65 }
66
73 public function getVersion()
74 {
75 return $this->version;
76 }
77
82 public function withTotalPrice(?TypedMoney $totalPrice)
83 {
84 $this->totalPrice = $totalPrice;
85
86 return $this;
87 }
88
93 public function withTaxedPrice(?TaxedPrice $taxedPrice)
94 {
95 $this->taxedPrice = $taxedPrice;
96
97 return $this;
98 }
99
104 public function withVersion(?int $version)
105 {
106 $this->version = $version;
107
108 return $this;
109 }
110
115 public function withTotalPriceBuilder(?TypedMoneyBuilder $totalPrice)
116 {
117 $this->totalPrice = $totalPrice;
118
119 return $this;
120 }
121
126 public function withTaxedPriceBuilder(?TaxedPriceBuilder $taxedPrice)
127 {
128 $this->taxedPrice = $taxedPrice;
129
130 return $this;
131 }
132
133 public function build(): OrderExcerpt
134 {
135 return new OrderExcerptModel(
136 $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice,
137 $this->taxedPrice instanceof TaxedPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice,
138 $this->version
139 );
140 }
141
142 public static function of(): OrderExcerptBuilder
143 {
144 return new self();
145 }
146}