commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
All Classes Namespaces Functions Variables Pages
TermFacetResultModel.php
1<?php
2
3declare(strict_types=1);
10
15use 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
103 public function getDataType()
104 {
105 if (is_null($this->dataType)) {
107 $data = $this->raw(self::FIELD_DATA_TYPE);
108 if (is_null($data)) {
109 return null;
110 }
111 $this->dataType = (string) $data;
112 }
113
114 return $this->dataType;
115 }
116
123 public function getMissing()
124 {
125 if (is_null($this->missing)) {
127 $data = $this->raw(self::FIELD_MISSING);
128 if (is_null($data)) {
129 return null;
130 }
131 $this->missing = (int) $data;
132 }
133
134 return $this->missing;
135 }
136
147 public function getTotal()
148 {
149 if (is_null($this->total)) {
151 $data = $this->raw(self::FIELD_TOTAL);
152 if (is_null($data)) {
153 return null;
154 }
155 $this->total = (int) $data;
156 }
157
158 return $this->total;
159 }
160
167 public function getOther()
168 {
169 if (is_null($this->other)) {
171 $data = $this->raw(self::FIELD_OTHER);
172 if (is_null($data)) {
173 return null;
174 }
175 $this->other = (int) $data;
176 }
177
178 return $this->other;
179 }
180
189 public function getTerms()
190 {
191 if (is_null($this->terms)) {
193 $data = $this->raw(self::FIELD_TERMS);
194 if (is_null($data)) {
195 return null;
196 }
197 $this->terms = FacetTermCollection::fromArray($data);
198 }
199
200 return $this->terms;
201 }
202
203
207 public function setDataType(?string $dataType): void
208 {
209 $this->dataType = $dataType;
210 }
211
215 public function setMissing(?int $missing): void
216 {
217 $this->missing = $missing;
218 }
219
223 public function setTotal(?int $total): void
224 {
225 $this->total = $total;
226 }
227
231 public function setOther(?int $other): void
232 {
233 $this->other = $other;
234 }
235
239 public function setTerms(?FacetTermCollection $terms): void
240 {
241 $this->terms = $terms;
242 }
243}
__construct(?string $dataType=null, ?int $missing=null, ?int $total=null, ?int $other=null, ?FacetTermCollection $terms=null, ?string $type=null)
static fromArray(array $data)