commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CustomerSearchRequestModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
24 {
29  protected $query;
30 
35  protected $sort;
36 
41  protected $limit;
42 
47  protected $offset;
48 
49 
53  public function __construct(
54  ?SearchQuery $query = null,
56  ?int $limit = null,
57  ?int $offset = null
58  ) {
59  $this->query = $query;
60  $this->sort = $sort;
61  $this->limit = $limit;
62  $this->offset = $offset;
63  }
64 
71  public function getQuery()
72  {
73  if (is_null($this->query)) {
75  $data = $this->raw(self::FIELD_QUERY);
76  if (is_null($data)) {
77  return null;
78  }
79 
80  $this->query = SearchQueryModel::of($data);
81  }
82 
83  return $this->query;
84  }
85 
92  public function getSort()
93  {
94  if (is_null($this->sort)) {
96  $data = $this->raw(self::FIELD_SORT);
97  if (is_null($data)) {
98  return null;
99  }
100  $this->sort = SearchSortingCollection::fromArray($data);
101  }
102 
103  return $this->sort;
104  }
105 
112  public function getLimit()
113  {
114  if (is_null($this->limit)) {
116  $data = $this->raw(self::FIELD_LIMIT);
117  if (is_null($data)) {
118  return null;
119  }
120  $this->limit = (int) $data;
121  }
122 
123  return $this->limit;
124  }
125 
132  public function getOffset()
133  {
134  if (is_null($this->offset)) {
136  $data = $this->raw(self::FIELD_OFFSET);
137  if (is_null($data)) {
138  return null;
139  }
140  $this->offset = (int) $data;
141  }
142 
143  return $this->offset;
144  }
145 
146 
150  public function setQuery(?SearchQuery $query): void
151  {
152  $this->query = $query;
153  }
154 
158  public function setSort(?SearchSortingCollection $sort): void
159  {
160  $this->sort = $sort;
161  }
162 
166  public function setLimit(?int $limit): void
167  {
168  $this->limit = $limit;
169  }
170 
174  public function setOffset(?int $offset): void
175  {
176  $this->offset = $offset;
177  }
178 }
__construct(?SearchQuery $query=null, ?SearchSortingCollection $sort=null, ?int $limit=null, ?int $offset=null)