commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
TextLineItemDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
20 use DateTimeImmutable;
21 use stdClass;
22 
26 final class TextLineItemDraftBuilder implements Builder
27 {
32  private $key;
33 
38  private $addedAt;
39 
44  private $custom;
45 
50  private $description;
51 
56  private $name;
57 
62  private $quantity;
63 
70  public function getKey()
71  {
72  return $this->key;
73  }
74 
81  public function getAddedAt()
82  {
83  return $this->addedAt;
84  }
85 
92  public function getCustom()
93  {
94  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
95  }
96 
103  public function getDescription()
104  {
105  return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
106  }
107 
114  public function getName()
115  {
116  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
117  }
118 
125  public function getQuantity()
126  {
127  return $this->quantity;
128  }
129 
134  public function withKey(?string $key)
135  {
136  $this->key = $key;
137 
138  return $this;
139  }
140 
145  public function withAddedAt(?DateTimeImmutable $addedAt)
146  {
147  $this->addedAt = $addedAt;
148 
149  return $this;
150  }
151 
156  public function withCustom(?CustomFieldsDraft $custom)
157  {
158  $this->custom = $custom;
159 
160  return $this;
161  }
162 
167  public function withDescription(?LocalizedString $description)
168  {
169  $this->description = $description;
170 
171  return $this;
172  }
173 
178  public function withName(?LocalizedString $name)
179  {
180  $this->name = $name;
181 
182  return $this;
183  }
184 
189  public function withQuantity(?int $quantity)
190  {
191  $this->quantity = $quantity;
192 
193  return $this;
194  }
195 
200  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
201  {
202  $this->custom = $custom;
203 
204  return $this;
205  }
206 
211  public function withDescriptionBuilder(?LocalizedStringBuilder $description)
212  {
213  $this->description = $description;
214 
215  return $this;
216  }
217 
222  public function withNameBuilder(?LocalizedStringBuilder $name)
223  {
224  $this->name = $name;
225 
226  return $this;
227  }
228 
229  public function build(): TextLineItemDraft
230  {
231  return new TextLineItemDraftModel(
232  $this->key,
233  $this->addedAt,
234  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
235  $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
236  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
237  $this->quantity
238  );
239  }
240 
241  public static function of(): TextLineItemDraftBuilder
242  {
243  return new self();
244  }
245 }