commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProductVariantPatchBuilder.php
1<?php
2
3declare(strict_types=1);
10
20use stdClass;
21
25final class ProductVariantPatchBuilder implements Builder
26{
31 private $productVariant;
32
37 private $attributes;
38
43 private $staged;
44
49 private $product;
50
58 public function getProductVariant()
59 {
60 return $this->productVariant instanceof ProductVariantKeyReferenceBuilder ? $this->productVariant->build() : $this->productVariant;
61 }
62
75 public function getAttributes()
76 {
77 return $this->attributes instanceof AttributesBuilder ? $this->attributes->build() : $this->attributes;
78 }
79
86 public function getStaged()
87 {
88 return $this->staged;
89 }
90
99 public function getProduct()
100 {
101 return $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product;
102 }
103
108 public function withProductVariant(?ProductVariantKeyReference $productVariant)
109 {
110 $this->productVariant = $productVariant;
111
112 return $this;
113 }
114
119 public function withAttributes(?Attributes $attributes)
120 {
121 $this->attributes = $attributes;
122
123 return $this;
124 }
125
130 public function withStaged(?bool $staged)
131 {
132 $this->staged = $staged;
133
134 return $this;
135 }
136
141 public function withProduct(?ProductKeyReference $product)
142 {
143 $this->product = $product;
144
145 return $this;
146 }
147
153 {
154 $this->productVariant = $productVariant;
155
156 return $this;
157 }
158
163 public function withAttributesBuilder(?AttributesBuilder $attributes)
164 {
165 $this->attributes = $attributes;
166
167 return $this;
168 }
169
175 {
176 $this->product = $product;
177
178 return $this;
179 }
180
181 public function build(): ProductVariantPatch
182 {
183 return new ProductVariantPatchModel(
184 $this->productVariant instanceof ProductVariantKeyReferenceBuilder ? $this->productVariant->build() : $this->productVariant,
185 $this->attributes instanceof AttributesBuilder ? $this->attributes->build() : $this->attributes,
186 $this->staged,
187 $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product
188 );
189 }
190
191 public static function of(): ProductVariantPatchBuilder
192 {
193 return new self();
194 }
195}
withProductVariantBuilder(?ProductVariantKeyReferenceBuilder $productVariant)