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