commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CustomerSearchRequestBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
19 use stdClass;
20 
24 final class CustomerSearchRequestBuilder implements Builder
25 {
30  private $query;
31 
36  private $sort;
37 
42  private $limit;
43 
48  private $offset;
49 
56  public function getQuery()
57  {
58  return $this->query instanceof SearchQueryBuilder ? $this->query->build() : $this->query;
59  }
60 
67  public function getSort()
68  {
69  return $this->sort;
70  }
71 
78  public function getLimit()
79  {
80  return $this->limit;
81  }
82 
89  public function getOffset()
90  {
91  return $this->offset;
92  }
93 
98  public function withQuery(?SearchQuery $query)
99  {
100  $this->query = $query;
101 
102  return $this;
103  }
104 
109  public function withSort(?SearchSortingCollection $sort)
110  {
111  $this->sort = $sort;
112 
113  return $this;
114  }
115 
120  public function withLimit(?int $limit)
121  {
122  $this->limit = $limit;
123 
124  return $this;
125  }
126 
131  public function withOffset(?int $offset)
132  {
133  $this->offset = $offset;
134 
135  return $this;
136  }
137 
142  public function withQueryBuilder(?SearchQueryBuilder $query)
143  {
144  $this->query = $query;
145 
146  return $this;
147  }
148 
149  public function build(): CustomerSearchRequest
150  {
151  return new CustomerSearchRequestModel(
152  $this->query instanceof SearchQueryBuilder ? $this->query->build() : $this->query,
153  $this->sort,
154  $this->limit,
155  $this->offset
156  );
157  }
158 
159  public static function of(): CustomerSearchRequestBuilder
160  {
161  return new self();
162  }
163 }