commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
VariantValuesModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
22 final class VariantValuesModel extends JsonObjectModel implements VariantValues
23 {
28  protected $sku;
29 
34  protected $prices;
35 
40  protected $attributes;
41 
42 
46  public function __construct(
47  ?string $sku = null,
50  ) {
51  $this->sku = $sku;
52  $this->prices = $prices;
53  $this->attributes = $attributes;
54  }
55 
60  public function getSku()
61  {
62  if (is_null($this->sku)) {
64  $data = $this->raw(self::FIELD_SKU);
65  if (is_null($data)) {
66  return null;
67  }
68  $this->sku = (string) $data;
69  }
70 
71  return $this->sku;
72  }
73 
78  public function getPrices()
79  {
80  if (is_null($this->prices)) {
82  $data = $this->raw(self::FIELD_PRICES);
83  if (is_null($data)) {
84  return null;
85  }
86  $this->prices = PriceImportCollection::fromArray($data);
87  }
88 
89  return $this->prices;
90  }
91 
96  public function getAttributes()
97  {
98  if (is_null($this->attributes)) {
100  $data = $this->raw(self::FIELD_ATTRIBUTES);
101  if (is_null($data)) {
102  return null;
103  }
104  $this->attributes = AttributeCollection::fromArray($data);
105  }
106 
107  return $this->attributes;
108  }
109 
110 
114  public function setSku(?string $sku): void
115  {
116  $this->sku = $sku;
117  }
118 
122  public function setPrices(?PriceImportCollection $prices): void
123  {
124  $this->prices = $prices;
125  }
126 
131  {
132  $this->attributes = $attributes;
133  }
134 }
__construct(?string $sku=null, ?PriceImportCollection $prices=null, ?AttributeCollection $attributes=null)