commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
PriceTierDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
16use stdClass;
17
21final class PriceTierDraftBuilder implements Builder
22{
27 private $minimumQuantity;
28
33 private $value;
34
44 public function getMinimumQuantity()
45 {
46 return $this->minimumQuantity;
47 }
48
57 public function getValue()
58 {
59 return $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value;
60 }
61
66 public function withMinimumQuantity(?int $minimumQuantity)
67 {
68 $this->minimumQuantity = $minimumQuantity;
69
70 return $this;
71 }
72
77 public function withValue(?Money $value)
78 {
79 $this->value = $value;
80
81 return $this;
82 }
83
88 public function withValueBuilder(?MoneyBuilder $value)
89 {
90 $this->value = $value;
91
92 return $this;
93 }
94
95 public function build(): PriceTierDraft
96 {
97 return new PriceTierDraftModel(
98 $this->minimumQuantity,
99 $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value
100 );
101 }
102
103 public static function of(): PriceTierDraftBuilder
104 {
105 return new self();
106 }
107}