commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
VariantModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
16
20final class VariantModel extends JsonObjectModel implements Variant
21{
22
23
28 protected $id;
29
34 protected $sku;
35
40 protected $key;
41
42
46 public function __construct(
47 ?int $id = null,
48 ?string $sku = null,
49 ?string $key = null
50 ) {
51 $this->id = $id;
52 $this->sku = $sku;
53 $this->key = $key;
54
55 }
56
61 public function getId()
62 {
63 if (is_null($this->id)) {
65 $data = $this->raw(self::FIELD_ID);
66 if (is_null($data)) {
67 return null;
68 }
69 $this->id = (int) $data;
70 }
71
72 return $this->id;
73 }
74
79 public function getSku()
80 {
81 if (is_null($this->sku)) {
83 $data = $this->raw(self::FIELD_SKU);
84 if (is_null($data)) {
85 return null;
86 }
87 $this->sku = (string) $data;
88 }
89
90 return $this->sku;
91 }
92
97 public function getKey()
98 {
99 if (is_null($this->key)) {
101 $data = $this->raw(self::FIELD_KEY);
102 if (is_null($data)) {
103 return null;
104 }
105 $this->key = (string) $data;
106 }
107
108 return $this->key;
109 }
110
111
115 public function setId(?int $id): void
116 {
117 $this->id = $id;
118 }
119
123 public function setSku(?string $sku): void
124 {
125 $this->sku = $sku;
126 }
127
131 public function setKey(?string $key): void
132 {
133 $this->key = $key;
134 }
135
136
137
138}
__construct(?int $id=null, ?string $sku=null, ?string $key=null)