commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ReviewRatingSetMessagePayloadModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
24  public const DISCRIMINATOR_VALUE = 'ReviewRatingSet';
29  protected $type;
30 
35  protected $oldRating;
36 
41  protected $newRating;
42 
48 
53  protected $target;
54 
55 
59  public function __construct(
60  ?float $oldRating = null,
61  ?float $newRating = null,
62  ?bool $includedInStatistics = null,
63  ?Reference $target = null,
64  ?string $type = null
65  ) {
66  $this->oldRating = $oldRating;
67  $this->newRating = $newRating;
68  $this->includedInStatistics = $includedInStatistics;
69  $this->target = $target;
70  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
71  }
72 
77  public function getType()
78  {
79  if (is_null($this->type)) {
81  $data = $this->raw(self::FIELD_TYPE);
82  if (is_null($data)) {
83  return null;
84  }
85  $this->type = (string) $data;
86  }
87 
88  return $this->type;
89  }
90 
97  public function getOldRating()
98  {
99  if (is_null($this->oldRating)) {
101  $data = $this->raw(self::FIELD_OLD_RATING);
102  if (is_null($data)) {
103  return null;
104  }
105  $this->oldRating = (float) $data;
106  }
107 
108  return $this->oldRating;
109  }
110 
117  public function getNewRating()
118  {
119  if (is_null($this->newRating)) {
121  $data = $this->raw(self::FIELD_NEW_RATING);
122  if (is_null($data)) {
123  return null;
124  }
125  $this->newRating = (float) $data;
126  }
127 
128  return $this->newRating;
129  }
130 
137  public function getIncludedInStatistics()
138  {
139  if (is_null($this->includedInStatistics)) {
141  $data = $this->raw(self::FIELD_INCLUDED_IN_STATISTICS);
142  if (is_null($data)) {
143  return null;
144  }
145  $this->includedInStatistics = (bool) $data;
146  }
147 
149  }
150 
157  public function getTarget()
158  {
159  if (is_null($this->target)) {
161  $data = $this->raw(self::FIELD_TARGET);
162  if (is_null($data)) {
163  return null;
164  }
165  $className = ReferenceModel::resolveDiscriminatorClass($data);
166  $this->target = $className::of($data);
167  }
168 
169  return $this->target;
170  }
171 
172 
176  public function setOldRating(?float $oldRating): void
177  {
178  $this->oldRating = $oldRating;
179  }
180 
184  public function setNewRating(?float $newRating): void
185  {
186  $this->newRating = $newRating;
187  }
188 
192  public function setIncludedInStatistics(?bool $includedInStatistics): void
193  {
194  $this->includedInStatistics = $includedInStatistics;
195  }
196 
200  public function setTarget(?Reference $target): void
201  {
202  $this->target = $target;
203  }
204 }
__construct(?float $oldRating=null, ?float $newRating=null, ?bool $includedInStatistics=null, ?Reference $target=null, ?string $type=null)