commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ChannelDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
23 use stdClass;
24 
28 final 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,
82  ?CustomFieldsDraft $custom = 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 
100  public function getKey()
101  {
102  if (is_null($this->key)) {
104  $data = $this->raw(self::FIELD_KEY);
105  if (is_null($data)) {
106  return null;
107  }
108  $this->key = (string) $data;
109  }
110 
111  return $this->key;
112  }
113 
122  public function getRoles()
123  {
124  if (is_null($this->roles)) {
126  $data = $this->raw(self::FIELD_ROLES);
127  if (is_null($data)) {
128  return null;
129  }
130  $this->roles = $data;
131  }
132 
133  return $this->roles;
134  }
135 
142  public function getName()
143  {
144  if (is_null($this->name)) {
146  $data = $this->raw(self::FIELD_NAME);
147  if (is_null($data)) {
148  return null;
149  }
150 
151  $this->name = LocalizedStringModel::of($data);
152  }
153 
154  return $this->name;
155  }
156 
163  public function getDescription()
164  {
165  if (is_null($this->description)) {
167  $data = $this->raw(self::FIELD_DESCRIPTION);
168  if (is_null($data)) {
169  return null;
170  }
171 
172  $this->description = LocalizedStringModel::of($data);
173  }
174 
175  return $this->description;
176  }
177 
184  public function getAddress()
185  {
186  if (is_null($this->address)) {
188  $data = $this->raw(self::FIELD_ADDRESS);
189  if (is_null($data)) {
190  return null;
191  }
192 
193  $this->address = BaseAddressModel::of($data);
194  }
195 
196  return $this->address;
197  }
198 
205  public function getCustom()
206  {
207  if (is_null($this->custom)) {
209  $data = $this->raw(self::FIELD_CUSTOM);
210  if (is_null($data)) {
211  return null;
212  }
213 
214  $this->custom = CustomFieldsDraftModel::of($data);
215  }
216 
217  return $this->custom;
218  }
219 
227  public function getGeoLocation()
228  {
229  if (is_null($this->geoLocation)) {
231  $data = $this->raw(self::FIELD_GEO_LOCATION);
232  if (is_null($data)) {
233  return null;
234  }
235  $className = GeoJsonModel::resolveDiscriminatorClass($data);
236  $this->geoLocation = $className::of($data);
237  }
238 
239  return $this->geoLocation;
240  }
241 
242 
246  public function setKey(?string $key): void
247  {
248  $this->key = $key;
249  }
250 
254  public function setRoles(?array $roles): void
255  {
256  $this->roles = $roles;
257  }
258 
262  public function setName(?LocalizedString $name): void
263  {
264  $this->name = $name;
265  }
266 
271  {
272  $this->description = $description;
273  }
274 
278  public function setAddress(?BaseAddress $address): void
279  {
280  $this->address = $address;
281  }
282 
286  public function setCustom(?CustomFieldsDraft $custom): void
287  {
288  $this->custom = $custom;
289  }
290 
294  public function setGeoLocation(?GeoJson $geoLocation): void
295  {
296  $this->geoLocation = $geoLocation;
297  }
298 }
__construct(?string $key=null, ?array $roles=null, ?LocalizedString $name=null, ?LocalizedString $description=null, ?BaseAddress $address=null, ?CustomFieldsDraft $custom=null, ?GeoJson $geoLocation=null)
static of($data=null)
Definition: MapperMap.php:45