commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ProductLabelModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
18 
22 final class ProductLabelModel extends JsonObjectModel implements ProductLabel
23 {
24 
25  public const DISCRIMINATOR_VALUE = 'ProductLabel';
30  protected $type;
31 
36  protected $slug;
37 
42  protected $name;
43 
44 
48  public function __construct(
49  ?LocalizedString $slug = null,
50  ?LocalizedString $name = null,
51  ?string $type = null
52  ) {
53  $this->slug = $slug;
54  $this->name = $name;
55  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
56  }
57 
62  public function getType()
63  {
64  if (is_null($this->type)) {
66  $data = $this->raw(self::FIELD_TYPE);
67  if (is_null($data)) {
68  return null;
69  }
70  $this->type = (string) $data;
71  }
72 
73  return $this->type;
74  }
75 
82  public function getSlug()
83  {
84  if (is_null($this->slug)) {
86  $data = $this->raw(self::FIELD_SLUG);
87  if (is_null($data)) {
88  return null;
89  }
90 
91  $this->slug = LocalizedStringModel::of($data);
92  }
93 
94  return $this->slug;
95  }
96 
103  public function getName()
104  {
105  if (is_null($this->name)) {
107  $data = $this->raw(self::FIELD_NAME);
108  if (is_null($data)) {
109  return null;
110  }
111 
112  $this->name = LocalizedStringModel::of($data);
113  }
114 
115  return $this->name;
116  }
117 
118 
122  public function setSlug(?LocalizedString $slug): void
123  {
124  $this->slug = $slug;
125  }
126 
130  public function setName(?LocalizedString $name): void
131  {
132  $this->name = $name;
133  }
134 
135 
136 
137 }
static of($data=null)
Definition: MapperMap.php:45
__construct(?LocalizedString $slug=null, ?LocalizedString $name=null, ?string $type=null)