commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
CustomFieldLocalizedEnumValueModel.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 
54  public function getKey()
55  {
56  if (is_null($this->key)) {
58  $data = $this->raw(self::FIELD_KEY);
59  if (is_null($data)) {
60  return null;
61  }
62  $this->key = (string) $data;
63  }
64 
65  return $this->key;
66  }
67 
74  public function getLabel()
75  {
76  if (is_null($this->label)) {
78  $data = $this->raw(self::FIELD_LABEL);
79  if (is_null($data)) {
80  return null;
81  }
82 
83  $this->label = LocalizedStringModel::of($data);
84  }
85 
86  return $this->label;
87  }
88 
89 
93  public function setKey(?string $key): void
94  {
95  $this->key = $key;
96  }
97 
101  public function setLabel(?LocalizedString $label): void
102  {
103  $this->label = $label;
104  }
105 }
static of($data=null)
Definition: MapperMap.php:45