commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
AttributeLocalizedEnumValueModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
28  protected $key;
29 
34  protected $label;
35 
36 
40  public function __construct(
41  ?string $key = null,
42  ?LocalizedString $label = null
43  ) {
44  $this->key = $key;
45  $this->label = $label;
46  }
47 
52  public function getKey()
53  {
54  if (is_null($this->key)) {
56  $data = $this->raw(self::FIELD_KEY);
57  if (is_null($data)) {
58  return null;
59  }
60  $this->key = (string) $data;
61  }
62 
63  return $this->key;
64  }
65 
77  public function getLabel()
78  {
79  if (is_null($this->label)) {
81  $data = $this->raw(self::FIELD_LABEL);
82  if (is_null($data)) {
83  return null;
84  }
85 
86  $this->label = LocalizedStringModel::of($data);
87  }
88 
89  return $this->label;
90  }
91 
92 
96  public function setKey(?string $key): void
97  {
98  $this->key = $key;
99  }
100 
104  public function setLabel(?LocalizedString $label): void
105  {
106  $this->label = $label;
107  }
108 }
static of($data=null)
Definition: MapperMap.php:45