commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ChannelDraftModel.php
1<?php
2
3declare(strict_types=1);
10
23use stdClass;
24
28final class ChannelDraftModel extends JsonObjectModel implements ChannelDraft
29{
34 protected $key;
35
40 protected $roles;
41
46 protected $name;
47
52 protected $description;
53
58 protected $address;
59
64 protected $custom;
65
70 protected $geoLocation;
71
72
76 public function __construct(
77 ?string $key = null,
78 ?array $roles = null,
79 ?LocalizedString $name = null,
81 ?BaseAddress $address = null,
83 ?GeoJson $geoLocation = null
84 ) {
85 $this->key = $key;
86 $this->roles = $roles;
87 $this->name = $name;
88 $this->description = $description;
89 $this->address = $address;
90 $this->custom = $custom;
91 $this->geoLocation = $geoLocation;
92 }
93
102 public function getKey()
103 {
104 if (is_null($this->key)) {
106 $data = $this->raw(self::FIELD_KEY);
107 if (is_null($data)) {
108 return null;
109 }
110 $this->key = (string) $data;
111 }
112
113 return $this->key;
114 }
115
123 public function getRoles()
124 {
125 if (is_null($this->roles)) {
127 $data = $this->raw(self::FIELD_ROLES);
128 if (is_null($data)) {
129 return null;
130 }
131 $this->roles = $data;
132 }
133
134 return $this->roles;
135 }
136
143 public function getName()
144 {
145 if (is_null($this->name)) {
147 $data = $this->raw(self::FIELD_NAME);
148 if (is_null($data)) {
149 return null;
150 }
151
152 $this->name = LocalizedStringModel::of($data);
153 }
154
155 return $this->name;
156 }
157
164 public function getDescription()
165 {
166 if (is_null($this->description)) {
168 $data = $this->raw(self::FIELD_DESCRIPTION);
169 if (is_null($data)) {
170 return null;
171 }
172
173 $this->description = LocalizedStringModel::of($data);
174 }
175
176 return $this->description;
177 }
178
185 public function getAddress()
186 {
187 if (is_null($this->address)) {
189 $data = $this->raw(self::FIELD_ADDRESS);
190 if (is_null($data)) {
191 return null;
192 }
193
194 $this->address = BaseAddressModel::of($data);
195 }
196
197 return $this->address;
198 }
199
206 public function getCustom()
207 {
208 if (is_null($this->custom)) {
210 $data = $this->raw(self::FIELD_CUSTOM);
211 if (is_null($data)) {
212 return null;
213 }
214
215 $this->custom = CustomFieldsDraftModel::of($data);
216 }
217
218 return $this->custom;
219 }
220
228 public function getGeoLocation()
229 {
230 if (is_null($this->geoLocation)) {
232 $data = $this->raw(self::FIELD_GEO_LOCATION);
233 if (is_null($data)) {
234 return null;
235 }
236 $className = GeoJsonModel::resolveDiscriminatorClass($data);
237 $this->geoLocation = $className::of($data);
238 }
239
240 return $this->geoLocation;
241 }
242
243
247 public function setKey(?string $key): void
248 {
249 $this->key = $key;
250 }
251
255 public function setRoles(?array $roles): void
256 {
257 $this->roles = $roles;
258 }
259
263 public function setName(?LocalizedString $name): void
264 {
265 $this->name = $name;
266 }
267
272 {
273 $this->description = $description;
274 }
275
279 public function setAddress(?BaseAddress $address): void
280 {
281 $this->address = $address;
282 }
283
287 public function setCustom(?CustomFieldsDraft $custom): void
288 {
289 $this->custom = $custom;
290 }
291
295 public function setGeoLocation(?GeoJson $geoLocation): void
296 {
297 $this->geoLocation = $geoLocation;
298 }
299}
__construct(?string $key=null, ?array $roles=null, ?LocalizedString $name=null, ?LocalizedString $description=null, ?BaseAddress $address=null, ?CustomFieldsDraft $custom=null, ?GeoJson $geoLocation=null)