commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ScopedPriceBuilder.php
1<?php
2
3declare(strict_types=1);
10
22use DateTimeImmutable;
23use stdClass;
24
28final class ScopedPriceBuilder implements Builder
29{
34 private $id;
35
40 private $value;
41
46 private $currentValue;
47
52 private $country;
53
58 private $customerGroup;
59
64 private $channel;
65
70 private $validFrom;
71
76 private $validUntil;
77
82 private $discounted;
83
88 private $custom;
89
96 public function getId()
97 {
98 return $this->id;
99 }
100
107 public function getValue()
108 {
109 return $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value;
110 }
111
118 public function getCurrentValue()
119 {
120 return $this->currentValue instanceof TypedMoneyBuilder ? $this->currentValue->build() : $this->currentValue;
121 }
122
129 public function getCountry()
130 {
131 return $this->country;
132 }
133
140 public function getCustomerGroup()
141 {
142 return $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup;
143 }
144
151 public function getChannel()
152 {
153 return $this->channel instanceof ChannelReferenceBuilder ? $this->channel->build() : $this->channel;
154 }
155
162 public function getValidFrom()
163 {
164 return $this->validFrom;
165 }
166
173 public function getValidUntil()
174 {
175 return $this->validUntil;
176 }
177
185 public function getDiscounted()
186 {
187 return $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted;
188 }
189
196 public function getCustom()
197 {
198 return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
199 }
200
205 public function withId(?string $id)
206 {
207 $this->id = $id;
208
209 return $this;
210 }
211
216 public function withValue(?TypedMoney $value)
217 {
218 $this->value = $value;
219
220 return $this;
221 }
222
227 public function withCurrentValue(?TypedMoney $currentValue)
228 {
229 $this->currentValue = $currentValue;
230
231 return $this;
232 }
233
238 public function withCountry(?string $country)
239 {
240 $this->country = $country;
241
242 return $this;
243 }
244
249 public function withCustomerGroup(?CustomerGroupReference $customerGroup)
250 {
251 $this->customerGroup = $customerGroup;
252
253 return $this;
254 }
255
260 public function withChannel(?ChannelReference $channel)
261 {
262 $this->channel = $channel;
263
264 return $this;
265 }
266
271 public function withValidFrom(?DateTimeImmutable $validFrom)
272 {
273 $this->validFrom = $validFrom;
274
275 return $this;
276 }
277
282 public function withValidUntil(?DateTimeImmutable $validUntil)
283 {
284 $this->validUntil = $validUntil;
285
286 return $this;
287 }
288
293 public function withDiscounted(?DiscountedPrice $discounted)
294 {
295 $this->discounted = $discounted;
296
297 return $this;
298 }
299
304 public function withCustom(?CustomFields $custom)
305 {
306 $this->custom = $custom;
307
308 return $this;
309 }
310
315 public function withValueBuilder(?TypedMoneyBuilder $value)
316 {
317 $this->value = $value;
318
319 return $this;
320 }
321
326 public function withCurrentValueBuilder(?TypedMoneyBuilder $currentValue)
327 {
328 $this->currentValue = $currentValue;
329
330 return $this;
331 }
332
338 {
339 $this->customerGroup = $customerGroup;
340
341 return $this;
342 }
343
349 {
350 $this->channel = $channel;
351
352 return $this;
353 }
354
359 public function withDiscountedBuilder(?DiscountedPriceBuilder $discounted)
360 {
361 $this->discounted = $discounted;
362
363 return $this;
364 }
365
370 public function withCustomBuilder(?CustomFieldsBuilder $custom)
371 {
372 $this->custom = $custom;
373
374 return $this;
375 }
376
377 public function build(): ScopedPrice
378 {
379 return new ScopedPriceModel(
380 $this->id,
381 $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value,
382 $this->currentValue instanceof TypedMoneyBuilder ? $this->currentValue->build() : $this->currentValue,
383 $this->country,
384 $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup,
385 $this->channel instanceof ChannelReferenceBuilder ? $this->channel->build() : $this->channel,
386 $this->validFrom,
387 $this->validUntil,
388 $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted,
389 $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom
390 );
391 }
392
393 public static function of(): ScopedPriceBuilder
394 {
395 return new self();
396 }
397}
withCustomerGroup(?CustomerGroupReference $customerGroup)
withDiscountedBuilder(?DiscountedPriceBuilder $discounted)
withCurrentValueBuilder(?TypedMoneyBuilder $currentValue)
withChannelBuilder(?ChannelReferenceBuilder $channel)
withCustomerGroupBuilder(?CustomerGroupReferenceBuilder $customerGroup)