commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CustomObjectBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
22 use DateTimeImmutable;
23 use stdClass;
24 
28 final class CustomObjectBuilder implements Builder
29 {
34  private $id;
35 
40  private $version;
41 
46  private $createdAt;
47 
52  private $lastModifiedAt;
53 
58  private $lastModifiedBy;
59 
64  private $createdBy;
65 
70  private $container;
71 
76  private $key;
77 
82  private $value;
83 
90  public function getId()
91  {
92  return $this->id;
93  }
94 
101  public function getVersion()
102  {
103  return $this->version;
104  }
105 
112  public function getCreatedAt()
113  {
114  return $this->createdAt;
115  }
116 
123  public function getLastModifiedAt()
124  {
125  return $this->lastModifiedAt;
126  }
127 
134  public function getLastModifiedBy()
135  {
136  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
137  }
138 
145  public function getCreatedBy()
146  {
147  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
148  }
149 
156  public function getContainer()
157  {
158  return $this->container;
159  }
160 
167  public function getKey()
168  {
169  return $this->key;
170  }
171 
181  public function getValue()
182  {
183  return $this->value;
184  }
185 
190  public function withId(?string $id)
191  {
192  $this->id = $id;
193 
194  return $this;
195  }
196 
201  public function withVersion(?int $version)
202  {
203  $this->version = $version;
204 
205  return $this;
206  }
207 
212  public function withCreatedAt(?DateTimeImmutable $createdAt)
213  {
214  $this->createdAt = $createdAt;
215 
216  return $this;
217  }
218 
223  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
224  {
225  $this->lastModifiedAt = $lastModifiedAt;
226 
227  return $this;
228  }
229 
234  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
235  {
236  $this->lastModifiedBy = $lastModifiedBy;
237 
238  return $this;
239  }
240 
245  public function withCreatedBy(?CreatedBy $createdBy)
246  {
247  $this->createdBy = $createdBy;
248 
249  return $this;
250  }
251 
256  public function withContainer(?string $container)
257  {
258  $this->container = $container;
259 
260  return $this;
261  }
262 
267  public function withKey(?string $key)
268  {
269  $this->key = $key;
270 
271  return $this;
272  }
273 
278  public function withValue($value)
279  {
280  $this->value = $value;
281 
282  return $this;
283  }
284 
289  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
290  {
291  $this->lastModifiedBy = $lastModifiedBy;
292 
293  return $this;
294  }
295 
300  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
301  {
302  $this->createdBy = $createdBy;
303 
304  return $this;
305  }
306 
307  public function build(): CustomObject
308  {
309  return new CustomObjectModel(
310  $this->id,
311  $this->version,
312  $this->createdAt,
313  $this->lastModifiedAt,
314  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
315  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
316  $this->container,
317  $this->key,
318  $this->value
319  );
320  }
321 
322  public static function of(): CustomObjectBuilder
323  {
324  return new self();
325  }
326 }
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)