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