commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
VariantBuilder.php
1<?php
2
3declare(strict_types=1);
10
16use stdClass;
17
21final class VariantBuilder implements Builder
22{
27 private $id;
28
33 private $sku;
34
39 private $key;
40
45 public function getId()
46 {
47 return $this->id;
48 }
49
54 public function getSku()
55 {
56 return $this->sku;
57 }
58
63 public function getKey()
64 {
65 return $this->key;
66 }
67
72 public function withId(?int $id)
73 {
74 $this->id = $id;
75
76 return $this;
77 }
78
83 public function withSku(?string $sku)
84 {
85 $this->sku = $sku;
86
87 return $this;
88 }
89
94 public function withKey(?string $key)
95 {
96 $this->key = $key;
97
98 return $this;
99 }
100
101
102 public function build(): Variant
103 {
104 return new VariantModel(
105 $this->id,
106 $this->sku,
107 $this->key
108 );
109 }
110
111 public static function of(): VariantBuilder
112 {
113 return new self();
114 }
115}