commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
TermFacetResultModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
21 {
22  public const DISCRIMINATOR_VALUE = 'terms';
27  protected $type;
28 
33  protected $dataType;
34 
39  protected $missing;
40 
45  protected $total;
46 
51  protected $other;
52 
57  protected $terms;
58 
59 
63  public function __construct(
64  ?string $dataType = null,
65  ?int $missing = null,
66  ?int $total = null,
67  ?int $other = null,
69  ?string $type = null
70  ) {
71  $this->dataType = $dataType;
72  $this->missing = $missing;
73  $this->total = $total;
74  $this->other = $other;
75  $this->terms = $terms;
76  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
77  }
78 
83  public function getType()
84  {
85  if (is_null($this->type)) {
87  $data = $this->raw(self::FIELD_TYPE);
88  if (is_null($data)) {
89  return null;
90  }
91  $this->type = (string) $data;
92  }
93 
94  return $this->type;
95  }
96 
101  public function getDataType()
102  {
103  if (is_null($this->dataType)) {
105  $data = $this->raw(self::FIELD_DATA_TYPE);
106  if (is_null($data)) {
107  return null;
108  }
109  $this->dataType = (string) $data;
110  }
111 
112  return $this->dataType;
113  }
114 
119  public function getMissing()
120  {
121  if (is_null($this->missing)) {
123  $data = $this->raw(self::FIELD_MISSING);
124  if (is_null($data)) {
125  return null;
126  }
127  $this->missing = (int) $data;
128  }
129 
130  return $this->missing;
131  }
132 
137  public function getTotal()
138  {
139  if (is_null($this->total)) {
141  $data = $this->raw(self::FIELD_TOTAL);
142  if (is_null($data)) {
143  return null;
144  }
145  $this->total = (int) $data;
146  }
147 
148  return $this->total;
149  }
150 
155  public function getOther()
156  {
157  if (is_null($this->other)) {
159  $data = $this->raw(self::FIELD_OTHER);
160  if (is_null($data)) {
161  return null;
162  }
163  $this->other = (int) $data;
164  }
165 
166  return $this->other;
167  }
168 
173  public function getTerms()
174  {
175  if (is_null($this->terms)) {
177  $data = $this->raw(self::FIELD_TERMS);
178  if (is_null($data)) {
179  return null;
180  }
181  $this->terms = FacetTermCollection::fromArray($data);
182  }
183 
184  return $this->terms;
185  }
186 
187 
191  public function setDataType(?string $dataType): void
192  {
193  $this->dataType = $dataType;
194  }
195 
199  public function setMissing(?int $missing): void
200  {
201  $this->missing = $missing;
202  }
203 
207  public function setTotal(?int $total): void
208  {
209  $this->total = $total;
210  }
211 
215  public function setOther(?int $other): void
216  {
217  $this->other = $other;
218  }
219 
223  public function setTerms(?FacetTermCollection $terms): void
224  {
225  $this->terms = $terms;
226  }
227 }
__construct(?string $dataType=null, ?int $missing=null, ?int $total=null, ?int $other=null, ?FacetTermCollection $terms=null, ?string $type=null)