commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
LocalizedEnumValueBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class LocalizedEnumValueBuilder implements Builder
22 {
27  private $key;
28 
33  private $label;
34 
39  public function getKey()
40  {
41  return $this->key;
42  }
43 
55  public function getLabel()
56  {
57  return $this->label instanceof LocalizedStringBuilder ? $this->label->build() : $this->label;
58  }
59 
64  public function withKey(?string $key)
65  {
66  $this->key = $key;
67 
68  return $this;
69  }
70 
75  public function withLabel(?LocalizedString $label)
76  {
77  $this->label = $label;
78 
79  return $this;
80  }
81 
86  public function withLabelBuilder(?LocalizedStringBuilder $label)
87  {
88  $this->label = $label;
89 
90  return $this;
91  }
92 
93  public function build(): LocalizedEnumValue
94  {
95  return new LocalizedEnumValueModel(
96  $this->key,
97  $this->label instanceof LocalizedStringBuilder ? $this->label->build() : $this->label
98  );
99  }
100 
101  public static function of(): LocalizedEnumValueBuilder
102  {
103  return new self();
104  }
105 }