commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
LocalizedLabelModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
18 
22 final class LocalizedLabelModel extends JsonObjectModel implements LocalizedLabel
23 {
24 
25  public const DISCRIMINATOR_VALUE = 'LocalizedLabel';
30  protected $type;
31 
36  protected $value;
37 
38 
42  public function __construct(
43  ?LocalizedString $value = null,
44  ?string $type = null
45  ) {
46  $this->value = $value;
47  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
48  }
49 
54  public function getType()
55  {
56  if (is_null($this->type)) {
58  $data = $this->raw(self::FIELD_TYPE);
59  if (is_null($data)) {
60  return null;
61  }
62  $this->type = (string) $data;
63  }
64 
65  return $this->type;
66  }
67 
74  public function getValue()
75  {
76  if (is_null($this->value)) {
78  $data = $this->raw(self::FIELD_VALUE);
79  if (is_null($data)) {
80  return null;
81  }
82 
83  $this->value = LocalizedStringModel::of($data);
84  }
85 
86  return $this->value;
87  }
88 
89 
93  public function setValue(?LocalizedString $value): void
94  {
95  $this->value = $value;
96  }
97 
98 
99 
100 }
static of($data=null)
Definition: MapperMap.php:45
__construct(?LocalizedString $value=null, ?string $type=null)