commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
lib
commercetools-api
src
Models
Product
ProductVariantBuilder.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Product
;
10
11
use
Commercetools\Api\Models\Common\AssetCollection
;
12
use
Commercetools\Api\Models\Common\ImageCollection
;
13
use
Commercetools\Api\Models\Common\Price
;
14
use
Commercetools\Api\Models\Common\PriceBuilder
;
15
use
Commercetools\Api\Models\Common\PriceCollection
;
16
use
Commercetools\Api\Models\Common\ScopedPrice
;
17
use
Commercetools\Api\Models\Common\ScopedPriceBuilder
;
18
use
Commercetools\Base\Builder
;
19
use
Commercetools\Base\DateTimeImmutableCollection
;
20
use
Commercetools\Base\JsonObject
;
21
use
Commercetools\Base\JsonObjectModel
;
22
use
Commercetools\Base\MapperFactory
;
23
use stdClass;
24
28
final
class
ProductVariantBuilder
implements
Builder
29
{
34
private
$id;
35
40
private
$sku;
41
46
private
$key;
47
52
private
$prices;
53
58
private
$attributes;
59
64
private
$price;
65
70
private
$images;
71
76
private
$assets;
77
82
private
$availability;
83
88
private
$isMatchingVariant;
89
94
private
$scopedPrice;
95
100
private
$scopedPriceDiscounted;
101
108
public
function
getId
()
109
{
110
return
$this->id;
111
}
112
119
public
function
getSku
()
120
{
121
return
$this->sku;
122
}
123
131
public
function
getKey
()
132
{
133
return
$this->key;
134
}
135
143
public
function
getPrices
()
144
{
145
return
$this->prices;
146
}
147
154
public
function
getAttributes
()
155
{
156
return
$this->attributes;
157
}
158
166
public
function
getPrice
()
167
{
168
return
$this->price instanceof
PriceBuilder
? $this->price->
build
() : $this->price;
169
}
170
177
public
function
getImages
()
178
{
179
return
$this->images;
180
}
181
188
public
function
getAssets
()
189
{
190
return
$this->assets;
191
}
192
201
public
function
getAvailability
()
202
{
203
return
$this->availability instanceof
ProductVariantAvailabilityBuilder
? $this->availability->
build
() : $this->availability;
204
}
205
213
public
function
getIsMatchingVariant
()
214
{
215
return
$this->isMatchingVariant;
216
}
217
226
public
function
getScopedPrice
()
227
{
228
return
$this->scopedPrice instanceof
ScopedPriceBuilder
? $this->scopedPrice->
build
() : $this->scopedPrice;
229
}
230
238
public
function
getScopedPriceDiscounted
()
239
{
240
return
$this->scopedPriceDiscounted;
241
}
242
247
public
function
withId
(?
int
$id)
248
{
249
$this->
id
= $id;
250
251
return
$this;
252
}
253
258
public
function
withSku
(?
string
$sku)
259
{
260
$this->sku = $sku;
261
262
return
$this;
263
}
264
269
public
function
withKey
(?
string
$key)
270
{
271
$this->key = $key;
272
273
return
$this;
274
}
275
280
public
function
withPrices
(?
PriceCollection
$prices)
281
{
282
$this->prices = $prices;
283
284
return
$this;
285
}
286
291
public
function
withAttributes
(?
AttributeCollection
$attributes)
292
{
293
$this->attributes = $attributes;
294
295
return
$this;
296
}
297
302
public
function
withPrice
(?
Price
$price)
303
{
304
$this->price = $price;
305
306
return
$this;
307
}
308
313
public
function
withImages
(?
ImageCollection
$images)
314
{
315
$this->images = $images;
316
317
return
$this;
318
}
319
324
public
function
withAssets
(?
AssetCollection
$assets)
325
{
326
$this->assets = $assets;
327
328
return
$this;
329
}
330
335
public
function
withAvailability
(?
ProductVariantAvailability
$availability)
336
{
337
$this->availability = $availability;
338
339
return
$this;
340
}
341
346
public
function
withIsMatchingVariant
(?
bool
$isMatchingVariant)
347
{
348
$this->isMatchingVariant = $isMatchingVariant;
349
350
return
$this;
351
}
352
357
public
function
withScopedPrice
(?
ScopedPrice
$scopedPrice)
358
{
359
$this->scopedPrice = $scopedPrice;
360
361
return
$this;
362
}
363
368
public
function
withScopedPriceDiscounted
(?
bool
$scopedPriceDiscounted)
369
{
370
$this->scopedPriceDiscounted = $scopedPriceDiscounted;
371
372
return
$this;
373
}
374
379
public
function
withPriceBuilder
(?
PriceBuilder
$price)
380
{
381
$this->price = $price;
382
383
return
$this;
384
}
385
390
public
function
withAvailabilityBuilder
(?
ProductVariantAvailabilityBuilder
$availability)
391
{
392
$this->availability = $availability;
393
394
return
$this;
395
}
396
401
public
function
withScopedPriceBuilder
(?
ScopedPriceBuilder
$scopedPrice)
402
{
403
$this->scopedPrice = $scopedPrice;
404
405
return
$this;
406
}
407
408
public
function
build
():
ProductVariant
409
{
410
return
new
ProductVariantModel
(
411
$this->
id
,
412
$this->sku,
413
$this->key,
414
$this->prices,
415
$this->attributes,
416
$this->price instanceof
PriceBuilder
? $this->price->
build
() : $this->price,
417
$this->images,
418
$this->assets,
419
$this->availability instanceof
ProductVariantAvailabilityBuilder
? $this->availability->
build
() : $this->availability,
420
$this->isMatchingVariant,
421
$this->scopedPrice instanceof
ScopedPriceBuilder
? $this->scopedPrice->
build
() : $this->scopedPrice,
422
$this->scopedPriceDiscounted
423
);
424
}
425
426
public
static
function
of
():
ProductVariantBuilder
427
{
428
return
new
self
();
429
}
430
}
Commercetools\Api\Models\Common\AssetCollection
Definition
AssetCollection.php:22
Commercetools\Api\Models\Common\ImageCollection
Definition
ImageCollection.php:22
Commercetools\Api\Models\Common\PriceBuilder
Definition
PriceBuilder.php:29
Commercetools\Api\Models\Common\PriceBuilder\build
build()
Definition
PriceBuilder.php:396
Commercetools\Api\Models\Common\PriceCollection
Definition
PriceCollection.php:22
Commercetools\Api\Models\Common\ScopedPriceBuilder
Definition
ScopedPriceBuilder.php:29
Commercetools\Api\Models\Common\ScopedPriceBuilder\build
build()
Definition
ScopedPriceBuilder.php:377
Commercetools\Api\Models\Product\AttributeCollection
Definition
AttributeCollection.php:22
Commercetools\Api\Models\Product\ProductVariantAvailabilityBuilder
Definition
ProductVariantAvailabilityBuilder.php:22
Commercetools\Api\Models\Product\ProductVariantAvailabilityBuilder\build
build()
Definition
ProductVariantAvailabilityBuilder.php:202
Commercetools\Api\Models\Product\ProductVariantBuilder
Definition
ProductVariantBuilder.php:29
Commercetools\Api\Models\Product\ProductVariantBuilder\withScopedPriceDiscounted
withScopedPriceDiscounted(?bool $scopedPriceDiscounted)
Definition
ProductVariantBuilder.php:368
Commercetools\Api\Models\Product\ProductVariantBuilder\getAvailability
getAvailability()
Definition
ProductVariantBuilder.php:201
Commercetools\Api\Models\Product\ProductVariantBuilder\withScopedPrice
withScopedPrice(?ScopedPrice $scopedPrice)
Definition
ProductVariantBuilder.php:357
Commercetools\Api\Models\Product\ProductVariantBuilder\getAssets
getAssets()
Definition
ProductVariantBuilder.php:188
Commercetools\Api\Models\Product\ProductVariantBuilder\getImages
getImages()
Definition
ProductVariantBuilder.php:177
Commercetools\Api\Models\Product\ProductVariantBuilder\withScopedPriceBuilder
withScopedPriceBuilder(?ScopedPriceBuilder $scopedPrice)
Definition
ProductVariantBuilder.php:401
Commercetools\Api\Models\Product\ProductVariantBuilder\withImages
withImages(?ImageCollection $images)
Definition
ProductVariantBuilder.php:313
Commercetools\Api\Models\Product\ProductVariantBuilder\withAvailabilityBuilder
withAvailabilityBuilder(?ProductVariantAvailabilityBuilder $availability)
Definition
ProductVariantBuilder.php:390
Commercetools\Api\Models\Product\ProductVariantBuilder\of
static of()
Definition
ProductVariantBuilder.php:426
Commercetools\Api\Models\Product\ProductVariantBuilder\getScopedPriceDiscounted
getScopedPriceDiscounted()
Definition
ProductVariantBuilder.php:238
Commercetools\Api\Models\Product\ProductVariantBuilder\withId
withId(?int $id)
Definition
ProductVariantBuilder.php:247
Commercetools\Api\Models\Product\ProductVariantBuilder\withAttributes
withAttributes(?AttributeCollection $attributes)
Definition
ProductVariantBuilder.php:291
Commercetools\Api\Models\Product\ProductVariantBuilder\withAssets
withAssets(?AssetCollection $assets)
Definition
ProductVariantBuilder.php:324
Commercetools\Api\Models\Product\ProductVariantBuilder\getScopedPrice
getScopedPrice()
Definition
ProductVariantBuilder.php:226
Commercetools\Api\Models\Product\ProductVariantBuilder\withAvailability
withAvailability(?ProductVariantAvailability $availability)
Definition
ProductVariantBuilder.php:335
Commercetools\Api\Models\Product\ProductVariantBuilder\withPriceBuilder
withPriceBuilder(?PriceBuilder $price)
Definition
ProductVariantBuilder.php:379
Commercetools\Api\Models\Product\ProductVariantBuilder\build
build()
Definition
ProductVariantBuilder.php:408
Commercetools\Api\Models\Product\ProductVariantBuilder\getPrice
getPrice()
Definition
ProductVariantBuilder.php:166
Commercetools\Api\Models\Product\ProductVariantBuilder\getId
getId()
Definition
ProductVariantBuilder.php:108
Commercetools\Api\Models\Product\ProductVariantBuilder\getIsMatchingVariant
getIsMatchingVariant()
Definition
ProductVariantBuilder.php:213
Commercetools\Api\Models\Product\ProductVariantBuilder\getSku
getSku()
Definition
ProductVariantBuilder.php:119
Commercetools\Api\Models\Product\ProductVariantBuilder\getKey
getKey()
Definition
ProductVariantBuilder.php:131
Commercetools\Api\Models\Product\ProductVariantBuilder\withPrices
withPrices(?PriceCollection $prices)
Definition
ProductVariantBuilder.php:280
Commercetools\Api\Models\Product\ProductVariantBuilder\getPrices
getPrices()
Definition
ProductVariantBuilder.php:143
Commercetools\Api\Models\Product\ProductVariantBuilder\withPrice
withPrice(?Price $price)
Definition
ProductVariantBuilder.php:302
Commercetools\Api\Models\Product\ProductVariantBuilder\withIsMatchingVariant
withIsMatchingVariant(?bool $isMatchingVariant)
Definition
ProductVariantBuilder.php:346
Commercetools\Api\Models\Product\ProductVariantBuilder\withKey
withKey(?string $key)
Definition
ProductVariantBuilder.php:269
Commercetools\Api\Models\Product\ProductVariantBuilder\getAttributes
getAttributes()
Definition
ProductVariantBuilder.php:154
Commercetools\Api\Models\Product\ProductVariantBuilder\withSku
withSku(?string $sku)
Definition
ProductVariantBuilder.php:258
Commercetools\Api\Models\Product\ProductVariantModel
Definition
ProductVariantModel.php:28
Commercetools\Base\DateTimeImmutableCollection
Definition
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition
MapperFactory.php:16
Commercetools\Api\Models\Common\Price
Definition
Price.php:19
Commercetools\Api\Models\Common\ScopedPrice
Definition
ScopedPrice.php:19
Commercetools\Api\Models\Product\ProductVariantAvailability
Definition
ProductVariantAvailability.php:15
Commercetools\Api\Models\Product\ProductVariant
Definition
ProductVariant.php:20
Commercetools\Base\Builder
Definition
Builder.php:16
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\Product
Definition
AttributeAccessor.php:4
Generated by
1.9.8