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
99 public function getValue()
100 {
101 return $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value;
102 }
103
110 public function getCountry()
111 {
112 return $this->country;
113 }
114
121 public function getCustomerGroup()
122 {
123 return $this->customerGroup instanceof CustomerGroupKeyReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup;
124 }
125
132 public function getChannel()
133 {
134 return $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel;
135 }
136
141 public function getValidFrom()
142 {
143 return $this->validFrom;
144 }
145
150 public function getValidUntil()
151 {
152 return $this->validUntil;
153 }
154
161 public function getCustom()
162 {
163 return $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom;
164 }
165
172 public function getDiscounted()
173 {
174 return $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted;
175 }
176
183 public function getTiers()
184 {
185 return $this->tiers;
186 }
187
194 public function getKey()
195 {
196 return $this->key;
197 }
198
203 public function withValue(?TypedMoney $value)
204 {
205 $this->value = $value;
206
207 return $this;
208 }
209
214 public function withCountry(?string $country)
215 {
216 $this->country = $country;
217
218 return $this;
219 }
220
225 public function withCustomerGroup(?CustomerGroupKeyReference $customerGroup)
226 {
227 $this->customerGroup = $customerGroup;
228
229 return $this;
230 }
231
236 public function withChannel(?ChannelKeyReference $channel)
237 {
238 $this->channel = $channel;
239
240 return $this;
241 }
242
247 public function withValidFrom(?DateTimeImmutable $validFrom)
248 {
249 $this->validFrom = $validFrom;
250
251 return $this;
252 }
253
258 public function withValidUntil(?DateTimeImmutable $validUntil)
259 {
260 $this->validUntil = $validUntil;
261
262 return $this;
263 }
264
269 public function withCustom(?Custom $custom)
270 {
271 $this->custom = $custom;
272
273 return $this;
274 }
275
280 public function withDiscounted(?DiscountedPrice $discounted)
281 {
282 $this->discounted = $discounted;
283
284 return $this;
285 }
286
291 public function withTiers(?PriceTierCollection $tiers)
292 {
293 $this->tiers = $tiers;
294
295 return $this;
296 }
297
302 public function withKey(?string $key)
303 {
304 $this->key = $key;
305
306 return $this;
307 }
308
313 public function withValueBuilder(?TypedMoneyBuilder $value)
314 {
315 $this->value = $value;
316
317 return $this;
318 }
319
325 {
326 $this->customerGroup = $customerGroup;
327
328 return $this;
329 }
330
336 {
337 $this->channel = $channel;
338
339 return $this;
340 }
341
346 public function withCustomBuilder(?CustomBuilder $custom)
347 {
348 $this->custom = $custom;
349
350 return $this;
351 }
352
357 public function withDiscountedBuilder(?DiscountedPriceBuilder $discounted)
358 {
359 $this->discounted = $discounted;
360
361 return $this;
362 }
363
364 public function build(): PriceDraftImport
365 {
366 return new PriceDraftImportModel(
367 $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value,
368 $this->country,
369 $this->customerGroup instanceof CustomerGroupKeyReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup,
370 $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel,
371 $this->validFrom,
372 $this->validUntil,
373 $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom,
374 $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted,
375 $this->tiers,
376 $this->key
377 );
378 }
379
380 public static function of(): PriceDraftImportBuilder
381 {
382 return new self();
383 }
384}
withCustomerGroupBuilder(?CustomerGroupKeyReferenceBuilder $customerGroup)