| @@ 219-235 (lines=17) @@ | ||
| 216 | * |
|
| 217 | * @return ResourceCollection |
|
| 218 | */ |
|
| 219 | public function getItems($params) |
|
| 220 | { |
|
| 221 | $itemCollection = new ResourceCollection( |
|
| 222 | new ItemAdapter( |
|
| 223 | $this->client, |
|
| 224 | $this->getNewRequest(self::SUPERDESK_ENDPOINT_ITEMS, $params) |
|
| 225 | ) |
|
| 226 | ); |
|
| 227 | ||
| 228 | $page = (isset($params['page'])) ? $params['page'] : 1; |
|
| 229 | $maxResults = (isset($params['max_results'])) ? $params['max_results'] : 25; |
|
| 230 | ||
| 231 | $itemCollection->setCurrentPage($page); |
|
| 232 | $itemCollection->setMaxPerPage($maxResults); |
|
| 233 | ||
| 234 | return $itemCollection; |
|
| 235 | } |
|
| 236 | ||
| 237 | /** |
|
| 238 | * Get package by identifier. |
|
| @@ 271-289 (lines=19) @@ | ||
| 268 | * |
|
| 269 | * @return ResourceCollection |
|
| 270 | */ |
|
| 271 | public function getPackages($params, $resolveAssociations = false) |
|
| 272 | { |
|
| 273 | $packageCollection = new ResourceCollection( |
|
| 274 | new PackageAdapter( |
|
| 275 | $this->client, |
|
| 276 | $this->getNewRequest(self::SUPERDESK_ENDPOINT_PACKAGES, $params), |
|
| 277 | $this, |
|
| 278 | $resolveAssociations |
|
| 279 | ) |
|
| 280 | ); |
|
| 281 | ||
| 282 | // TODO: Check if we actually need these 5 lines of code |
|
| 283 | $page = (isset($params['page'])) ? $params['page'] : 1; |
|
| 284 | $maxResults = (isset($params['max_results'])) ? $params['max_results'] : 25; |
|
| 285 | ||
| 286 | $packageCollection->setCurrentPage($page); |
|
| 287 | $packageCollection->setMaxPerPage($maxResults); |
|
| 288 | ||
| 289 | return $packageCollection; |
|
| 290 | } |
|
| 291 | ||
| 292 | /** |
|