commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
LineItemPriceBuilder.php
1<?php
2
3declare(strict_types=1);
10
27use DateTimeImmutable;
28use stdClass;
29
33final class LineItemPriceBuilder implements Builder
34{
39 private $value;
40
45 private $country;
46
51 private $validFrom;
52
57 private $validUntil;
58
63 private $customerGroup;
64
69 private $channel;
70
75 private $discounted;
76
81 private $tiers;
82
87 private $custom;
88
95 public function getValue()
96 {
97 return $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value;
98 }
99
106 public function getCountry()
107 {
108 return $this->country;
109 }
110
117 public function getValidFrom()
118 {
119 return $this->validFrom;
120 }
121
128 public function getValidUntil()
129 {
130 return $this->validUntil;
131 }
132
139 public function getCustomerGroup()
140 {
141 return $this->customerGroup instanceof CustomerGroupKeyReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup;
142 }
143
150 public function getChannel()
151 {
152 return $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel;
153 }
154
161 public function getDiscounted()
162 {
163 return $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted;
164 }
165
172 public function getTiers()
173 {
174 return $this->tiers;
175 }
176
183 public function getCustom()
184 {
185 return $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom;
186 }
187
192 public function withValue(?TypedMoney $value)
193 {
194 $this->value = $value;
195
196 return $this;
197 }
198
203 public function withCountry(?string $country)
204 {
205 $this->country = $country;
206
207 return $this;
208 }
209
214 public function withValidFrom(?DateTimeImmutable $validFrom)
215 {
216 $this->validFrom = $validFrom;
217
218 return $this;
219 }
220
225 public function withValidUntil(?DateTimeImmutable $validUntil)
226 {
227 $this->validUntil = $validUntil;
228
229 return $this;
230 }
231
236 public function withCustomerGroup(?CustomerGroupKeyReference $customerGroup)
237 {
238 $this->customerGroup = $customerGroup;
239
240 return $this;
241 }
242
247 public function withChannel(?ChannelKeyReference $channel)
248 {
249 $this->channel = $channel;
250
251 return $this;
252 }
253
258 public function withDiscounted(?DiscountedPrice $discounted)
259 {
260 $this->discounted = $discounted;
261
262 return $this;
263 }
264
269 public function withTiers(?PriceTierCollection $tiers)
270 {
271 $this->tiers = $tiers;
272
273 return $this;
274 }
275
280 public function withCustom(?Custom $custom)
281 {
282 $this->custom = $custom;
283
284 return $this;
285 }
286
291 public function withValueBuilder(?TypedMoneyBuilder $value)
292 {
293 $this->value = $value;
294
295 return $this;
296 }
297
303 {
304 $this->customerGroup = $customerGroup;
305
306 return $this;
307 }
308
314 {
315 $this->channel = $channel;
316
317 return $this;
318 }
319
324 public function withDiscountedBuilder(?DiscountedPriceBuilder $discounted)
325 {
326 $this->discounted = $discounted;
327
328 return $this;
329 }
330
335 public function withCustomBuilder(?CustomBuilder $custom)
336 {
337 $this->custom = $custom;
338
339 return $this;
340 }
341
342 public function build(): LineItemPrice
343 {
344 return new LineItemPriceModel(
345 $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value,
346 $this->country,
347 $this->validFrom,
348 $this->validUntil,
349 $this->customerGroup instanceof CustomerGroupKeyReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup,
350 $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel,
351 $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted,
352 $this->tiers,
353 $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom
354 );
355 }
356
357 public static function of(): LineItemPriceBuilder
358 {
359 return new self();
360 }
361}
withCustomerGroup(?CustomerGroupKeyReference $customerGroup)
withCustomerGroupBuilder(?CustomerGroupKeyReferenceBuilder $customerGroup)