commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
LocalizedStringFieldModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
24  public const DISCRIMINATOR_VALUE = 'LocalizedString';
29  protected $type;
30 
35  protected $value;
36 
37 
41  public function __construct(
42  ?LocalizedString $value = null,
43  ?string $type = null
44  ) {
45  $this->value = $value;
46  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
47  }
48 
55  public function getType()
56  {
57  if (is_null($this->type)) {
59  $data = $this->raw(self::FIELD_TYPE);
60  if (is_null($data)) {
61  return null;
62  }
63  $this->type = (string) $data;
64  }
65 
66  return $this->type;
67  }
68 
80  public function getValue()
81  {
82  if (is_null($this->value)) {
84  $data = $this->raw(self::FIELD_VALUE);
85  if (is_null($data)) {
86  return null;
87  }
88 
89  $this->value = LocalizedStringModel::of($data);
90  }
91 
92  return $this->value;
93  }
94 
95 
99  public function setValue(?LocalizedString $value): void
100  {
101  $this->value = $value;
102  }
103 }
static of($data=null)
Definition: MapperMap.php:45