commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
PagedQueryResponseModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
16
21{
26 protected $limit;
27
32 protected $offset;
33
38 protected $count;
39
44 protected $total;
45
50 protected $results;
51
56 protected $meta;
57
58
62 public function __construct(
63 ?int $limit = null,
64 ?int $offset = null,
65 ?int $count = null,
66 ?int $total = null,
68 ?JsonObject $meta = null
69 ) {
70 $this->limit = $limit;
71 $this->offset = $offset;
72 $this->count = $count;
73 $this->total = $total;
74 $this->results = $results;
75 $this->meta = $meta;
76 }
77
84 public function getLimit()
85 {
86 if (is_null($this->limit)) {
88 $data = $this->raw(self::FIELD_LIMIT);
89 if (is_null($data)) {
90 return null;
91 }
92 $this->limit = (int) $data;
93 }
94
95 return $this->limit;
96 }
97
104 public function getOffset()
105 {
106 if (is_null($this->offset)) {
108 $data = $this->raw(self::FIELD_OFFSET);
109 if (is_null($data)) {
110 return null;
111 }
112 $this->offset = (int) $data;
113 }
114
115 return $this->offset;
116 }
117
124 public function getCount()
125 {
126 if (is_null($this->count)) {
128 $data = $this->raw(self::FIELD_COUNT);
129 if (is_null($data)) {
130 return null;
131 }
132 $this->count = (int) $data;
133 }
134
135 return $this->count;
136 }
137
148 public function getTotal()
149 {
150 if (is_null($this->total)) {
152 $data = $this->raw(self::FIELD_TOTAL);
153 if (is_null($data)) {
154 return null;
155 }
156 $this->total = (int) $data;
157 }
158
159 return $this->total;
160 }
161
166 public function getResults()
167 {
168 if (is_null($this->results)) {
170 $data = $this->raw(self::FIELD_RESULTS);
171 if (is_null($data)) {
172 return null;
173 }
174 $this->results = BaseResourceCollection::fromArray($data);
175 }
176
177 return $this->results;
178 }
179
184 public function getMeta()
185 {
186 if (is_null($this->meta)) {
188 $data = $this->raw(self::FIELD_META);
189 if (is_null($data)) {
190 return null;
191 }
192 $this->meta = JsonObjectModel::of($data);
193 }
194
195 return $this->meta;
196 }
197
198
202 public function setLimit(?int $limit): void
203 {
204 $this->limit = $limit;
205 }
206
210 public function setOffset(?int $offset): void
211 {
212 $this->offset = $offset;
213 }
214
218 public function setCount(?int $count): void
219 {
220 $this->count = $count;
221 }
222
226 public function setTotal(?int $total): void
227 {
228 $this->total = $total;
229 }
230
235 {
236 $this->results = $results;
237 }
238
242 public function setMeta(?JsonObject $meta): void
243 {
244 $this->meta = $meta;
245 }
246}
__construct(?int $limit=null, ?int $offset=null, ?int $count=null, ?int $total=null, ?BaseResourceCollection $results=null, ?JsonObject $meta=null)
static fromArray(array $data)