commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
EnumValueModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
20 final class EnumValueModel extends JsonObjectModel implements EnumValue
21 {
26  protected $key;
27 
32  protected $label;
33 
34 
38  public function __construct(
39  ?string $key = null,
40  ?string $label = null
41  ) {
42  $this->key = $key;
43  $this->label = $label;
44  }
45 
50  public function getKey()
51  {
52  if (is_null($this->key)) {
54  $data = $this->raw(self::FIELD_KEY);
55  if (is_null($data)) {
56  return null;
57  }
58  $this->key = (string) $data;
59  }
60 
61  return $this->key;
62  }
63 
68  public function getLabel()
69  {
70  if (is_null($this->label)) {
72  $data = $this->raw(self::FIELD_LABEL);
73  if (is_null($data)) {
74  return null;
75  }
76  $this->label = (string) $data;
77  }
78 
79  return $this->label;
80  }
81 
82 
86  public function setKey(?string $key): void
87  {
88  $this->key = $key;
89  }
90 
94  public function setLabel(?string $label): void
95  {
96  $this->label = $label;
97  }
98 }
__construct(?string $key=null, ?string $label=null)