commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
OrderSearchRequestBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class OrderSearchRequestBuilder implements Builder
22 {
27  private $query;
28 
33  private $sort;
34 
39  private $limit;
40 
45  private $offset;
46 
53  public function getQuery()
54  {
55  return $this->query instanceof OrderSearchQueryBuilder ? $this->query->build() : $this->query;
56  }
57 
64  public function getSort()
65  {
66  return $this->sort;
67  }
68 
75  public function getLimit()
76  {
77  return $this->limit;
78  }
79 
86  public function getOffset()
87  {
88  return $this->offset;
89  }
90 
95  public function withQuery(?OrderSearchQuery $query)
96  {
97  $this->query = $query;
98 
99  return $this;
100  }
101 
106  public function withSort(?OrderSearchSortingCollection $sort)
107  {
108  $this->sort = $sort;
109 
110  return $this;
111  }
112 
117  public function withLimit(?int $limit)
118  {
119  $this->limit = $limit;
120 
121  return $this;
122  }
123 
128  public function withOffset(?int $offset)
129  {
130  $this->offset = $offset;
131 
132  return $this;
133  }
134 
139  public function withQueryBuilder(?OrderSearchQueryBuilder $query)
140  {
141  $this->query = $query;
142 
143  return $this;
144  }
145 
146  public function build(): OrderSearchRequest
147  {
148  return new OrderSearchRequestModel(
149  $this->query instanceof OrderSearchQueryBuilder ? $this->query->build() : $this->query,
150  $this->sort,
151  $this->limit,
152  $this->offset
153  );
154  }
155 
156  public static function of(): OrderSearchRequestBuilder
157  {
158  return new self();
159  }
160 }