commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
SetLineItemPriceChangeBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
21 
25 final class SetLineItemPriceChangeBuilder implements Builder
26 {
31  private $change;
32 
37  private $previousValue;
38 
43  private $nextValue;
44 
49  private $lineItem;
50 
55  public function getChange()
56  {
57  return $this->change;
58  }
59 
66  public function getPreviousValue()
67  {
68  return $this->previousValue instanceof PriceBuilder ? $this->previousValue->build() : $this->previousValue;
69  }
70 
77  public function getNextValue()
78  {
79  return $this->nextValue instanceof PriceBuilder ? $this->nextValue->build() : $this->nextValue;
80  }
81 
88  public function getLineItem()
89  {
90  return $this->lineItem instanceof LocalizedStringBuilder ? $this->lineItem->build() : $this->lineItem;
91  }
92 
97  public function withChange(?string $change)
98  {
99  $this->change = $change;
100 
101  return $this;
102  }
103 
108  public function withPreviousValue(?Price $previousValue)
109  {
110  $this->previousValue = $previousValue;
111 
112  return $this;
113  }
114 
119  public function withNextValue(?Price $nextValue)
120  {
121  $this->nextValue = $nextValue;
122 
123  return $this;
124  }
125 
130  public function withLineItem(?LocalizedString $lineItem)
131  {
132  $this->lineItem = $lineItem;
133 
134  return $this;
135  }
136 
141  public function withPreviousValueBuilder(?PriceBuilder $previousValue)
142  {
143  $this->previousValue = $previousValue;
144 
145  return $this;
146  }
147 
152  public function withNextValueBuilder(?PriceBuilder $nextValue)
153  {
154  $this->nextValue = $nextValue;
155 
156  return $this;
157  }
158 
163  public function withLineItemBuilder(?LocalizedStringBuilder $lineItem)
164  {
165  $this->lineItem = $lineItem;
166 
167  return $this;
168  }
169 
170  public function build(): SetLineItemPriceChange
171  {
172  return new SetLineItemPriceChangeModel(
173  $this->change,
174  $this->previousValue instanceof PriceBuilder ? $this->previousValue->build() : $this->previousValue,
175  $this->nextValue instanceof PriceBuilder ? $this->nextValue->build() : $this->nextValue,
176  $this->lineItem instanceof LocalizedStringBuilder ? $this->lineItem->build() : $this->lineItem
177  );
178  }
179 
180  public static function of(): SetLineItemPriceChangeBuilder
181  {
182  return new self();
183  }
184 }