commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
PriceDraftImportBuilder.php
1<?php
2
3declare(strict_types=1);
10
27use DateTimeImmutable;
28use stdClass;
29
33final class PriceDraftImportBuilder implements Builder
34{
39 private $value;
40
45 private $country;
46
51 private $customerGroup;
52
57 private $channel;
58
63 private $validFrom;
64
69 private $validUntil;
70
75 private $custom;
76
81 private $discounted;
82
87 private $tiers;
88
93 private $key;
94
101 public function getValue()
102 {
103 return $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value;
104 }
105
112 public function getCountry()
113 {
114 return $this->country;
115 }
116
123 public function getCustomerGroup()
124 {
125 return $this->customerGroup instanceof CustomerGroupKeyReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup;
126 }
127
134 public function getChannel()
135 {
136 return $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel;
137 }
138
145 public function getValidFrom()
146 {
147 return $this->validFrom;
148 }
149
156 public function getValidUntil()
157 {
158 return $this->validUntil;
159 }
160
167 public function getCustom()
168 {
169 return $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom;
170 }
171
178 public function getDiscounted()
179 {
180 return $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted;
181 }
182
189 public function getTiers()
190 {
191 return $this->tiers;
192 }
193
200 public function getKey()
201 {
202 return $this->key;
203 }
204
209 public function withValue(?TypedMoney $value)
210 {
211 $this->value = $value;
212
213 return $this;
214 }
215
220 public function withCountry(?string $country)
221 {
222 $this->country = $country;
223
224 return $this;
225 }
226
231 public function withCustomerGroup(?CustomerGroupKeyReference $customerGroup)
232 {
233 $this->customerGroup = $customerGroup;
234
235 return $this;
236 }
237
242 public function withChannel(?ChannelKeyReference $channel)
243 {
244 $this->channel = $channel;
245
246 return $this;
247 }
248
253 public function withValidFrom(?DateTimeImmutable $validFrom)
254 {
255 $this->validFrom = $validFrom;
256
257 return $this;
258 }
259
264 public function withValidUntil(?DateTimeImmutable $validUntil)
265 {
266 $this->validUntil = $validUntil;
267
268 return $this;
269 }
270
275 public function withCustom(?Custom $custom)
276 {
277 $this->custom = $custom;
278
279 return $this;
280 }
281
286 public function withDiscounted(?DiscountedPrice $discounted)
287 {
288 $this->discounted = $discounted;
289
290 return $this;
291 }
292
297 public function withTiers(?PriceTierCollection $tiers)
298 {
299 $this->tiers = $tiers;
300
301 return $this;
302 }
303
308 public function withKey(?string $key)
309 {
310 $this->key = $key;
311
312 return $this;
313 }
314
319 public function withValueBuilder(?TypedMoneyBuilder $value)
320 {
321 $this->value = $value;
322
323 return $this;
324 }
325
331 {
332 $this->customerGroup = $customerGroup;
333
334 return $this;
335 }
336
342 {
343 $this->channel = $channel;
344
345 return $this;
346 }
347
352 public function withCustomBuilder(?CustomBuilder $custom)
353 {
354 $this->custom = $custom;
355
356 return $this;
357 }
358
363 public function withDiscountedBuilder(?DiscountedPriceBuilder $discounted)
364 {
365 $this->discounted = $discounted;
366
367 return $this;
368 }
369
370 public function build(): PriceDraftImport
371 {
372 return new PriceDraftImportModel(
373 $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value,
374 $this->country,
375 $this->customerGroup instanceof CustomerGroupKeyReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup,
376 $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel,
377 $this->validFrom,
378 $this->validUntil,
379 $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom,
380 $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted,
381 $this->tiers,
382 $this->key
383 );
384 }
385
386 public static function of(): PriceDraftImportBuilder
387 {
388 return new self();
389 }
390}
withCustomerGroupBuilder(?CustomerGroupKeyReferenceBuilder $customerGroup)