| @@ 250-266 (lines=17) @@ | ||
| 247 | * |
|
| 248 | * @return ResourceCollection |
|
| 249 | */ |
|
| 250 | public function getItems($params) |
|
| 251 | { |
|
| 252 | $itemCollection = new ResourceCollection( |
|
| 253 | new ItemAdapter( |
|
| 254 | $this->client, |
|
| 255 | $this->getNewRequest(self::SUPERDESK_ENDPOINT_ITEMS, $params) |
|
| 256 | ) |
|
| 257 | ); |
|
| 258 | ||
| 259 | $page = (isset($params['page'])) ? $params['page'] : 1; |
|
| 260 | $maxResults = (isset($params['max_results'])) ? $params['max_results'] : 25; |
|
| 261 | ||
| 262 | $itemCollection->setCurrentPage($page); |
|
| 263 | $itemCollection->setMaxPerPage($maxResults); |
|
| 264 | ||
| 265 | return $itemCollection; |
|
| 266 | } |
|
| 267 | ||
| 268 | /** |
|
| 269 | * Get package by identifier. |
|
| @@ 302-320 (lines=19) @@ | ||
| 299 | * |
|
| 300 | * @return ResourceCollection |
|
| 301 | */ |
|
| 302 | public function getPackages($params, $resolveAssociations = false) |
|
| 303 | { |
|
| 304 | $packageCollection = new ResourceCollection( |
|
| 305 | new PackageAdapter( |
|
| 306 | $this->client, |
|
| 307 | $this->getNewRequest(self::SUPERDESK_ENDPOINT_PACKAGES, $params), |
|
| 308 | $this, |
|
| 309 | $resolveAssociations |
|
| 310 | ) |
|
| 311 | ); |
|
| 312 | ||
| 313 | // TODO: Check if we actually need these 5 lines of code |
|
| 314 | $page = (isset($params['page'])) ? $params['page'] : 1; |
|
| 315 | $maxResults = (isset($params['max_results'])) ? $params['max_results'] : 25; |
|
| 316 | ||
| 317 | $packageCollection->setCurrentPage($page); |
|
| 318 | $packageCollection->setMaxPerPage($maxResults); |
|
| 319 | ||
| 320 | return $packageCollection; |
|
| 321 | } |
|
| 322 | ||
| 323 | /** |
|