commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
SearchSortingModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
20 final class SearchSortingModel extends JsonObjectModel implements SearchSorting
21 {
26  protected $field;
27 
32  protected $language;
33 
38  protected $order;
39 
44  protected $mode;
45 
50  protected $fieldType;
51 
56  protected $filter;
57 
58 
62  public function __construct(
63  ?string $field = null,
64  ?string $language = null,
65  ?string $order = null,
66  ?string $mode = null,
67  ?string $fieldType = null,
69  ) {
70  $this->field = $field;
71  $this->language = $language;
72  $this->order = $order;
73  $this->mode = $mode;
74  $this->fieldType = $fieldType;
75  $this->filter = $filter;
76  }
77 
84  public function getField()
85  {
86  if (is_null($this->field)) {
88  $data = $this->raw(self::FIELD_FIELD);
89  if (is_null($data)) {
90  return null;
91  }
92  $this->field = (string) $data;
93  }
94 
95  return $this->field;
96  }
97 
104  public function getLanguage()
105  {
106  if (is_null($this->language)) {
108  $data = $this->raw(self::FIELD_LANGUAGE);
109  if (is_null($data)) {
110  return null;
111  }
112  $this->language = (string) $data;
113  }
114 
115  return $this->language;
116  }
117 
125  public function getOrder()
126  {
127  if (is_null($this->order)) {
129  $data = $this->raw(self::FIELD_ORDER);
130  if (is_null($data)) {
131  return null;
132  }
133  $this->order = (string) $data;
134  }
135 
136  return $this->order;
137  }
138 
145  public function getMode()
146  {
147  if (is_null($this->mode)) {
149  $data = $this->raw(self::FIELD_MODE);
150  if (is_null($data)) {
151  return null;
152  }
153  $this->mode = (string) $data;
154  }
155 
156  return $this->mode;
157  }
158 
165  public function getFieldType()
166  {
167  if (is_null($this->fieldType)) {
169  $data = $this->raw(self::FIELD_FIELD_TYPE);
170  if (is_null($data)) {
171  return null;
172  }
173  $this->fieldType = (string) $data;
174  }
175 
176  return $this->fieldType;
177  }
178 
185  public function getFilter()
186  {
187  if (is_null($this->filter)) {
189  $data = $this->raw(self::FIELD_FILTER);
190  if (is_null($data)) {
191  return null;
192  }
193 
194  $this->filter = SearchQueryExpressionModel::of($data);
195  }
196 
197  return $this->filter;
198  }
199 
200 
204  public function setField(?string $field): void
205  {
206  $this->field = $field;
207  }
208 
212  public function setLanguage(?string $language): void
213  {
214  $this->language = $language;
215  }
216 
220  public function setOrder(?string $order): void
221  {
222  $this->order = $order;
223  }
224 
228  public function setMode(?string $mode): void
229  {
230  $this->mode = $mode;
231  }
232 
236  public function setFieldType(?string $fieldType): void
237  {
238  $this->fieldType = $fieldType;
239  }
240 
244  public function setFilter(?SearchQueryExpression $filter): void
245  {
246  $this->filter = $filter;
247  }
248 }
__construct(?string $field=null, ?string $language=null, ?string $order=null, ?string $mode=null, ?string $fieldType=null, ?SearchQueryExpression $filter=null)