commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
SearchSortingBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class SearchSortingBuilder implements Builder
22 {
27  private $field;
28 
33  private $language;
34 
39  private $order;
40 
45  private $mode;
46 
51  private $fieldType;
52 
57  private $filter;
58 
65  public function getField()
66  {
67  return $this->field;
68  }
69 
76  public function getLanguage()
77  {
78  return $this->language;
79  }
80 
88  public function getOrder()
89  {
90  return $this->order;
91  }
92 
99  public function getMode()
100  {
101  return $this->mode;
102  }
103 
110  public function getFieldType()
111  {
112  return $this->fieldType;
113  }
114 
121  public function getFilter()
122  {
123  return $this->filter instanceof SearchQueryExpressionBuilder ? $this->filter->build() : $this->filter;
124  }
125 
130  public function withField(?string $field)
131  {
132  $this->field = $field;
133 
134  return $this;
135  }
136 
141  public function withLanguage(?string $language)
142  {
143  $this->language = $language;
144 
145  return $this;
146  }
147 
152  public function withOrder(?string $order)
153  {
154  $this->order = $order;
155 
156  return $this;
157  }
158 
163  public function withMode(?string $mode)
164  {
165  $this->mode = $mode;
166 
167  return $this;
168  }
169 
174  public function withFieldType(?string $fieldType)
175  {
176  $this->fieldType = $fieldType;
177 
178  return $this;
179  }
180 
185  public function withFilter(?SearchQueryExpression $filter)
186  {
187  $this->filter = $filter;
188 
189  return $this;
190  }
191 
197  {
198  $this->filter = $filter;
199 
200  return $this;
201  }
202 
203  public function build(): SearchSorting
204  {
205  return new SearchSortingModel(
206  $this->field,
207  $this->language,
208  $this->order,
209  $this->mode,
210  $this->fieldType,
211  $this->filter instanceof SearchQueryExpressionBuilder ? $this->filter->build() : $this->filter
212  );
213  }
214 
215  public static function of(): SearchSortingBuilder
216  {
217  return new self();
218  }
219 }
withFilterBuilder(?SearchQueryExpressionBuilder $filter)