You are here

private function Mollie_API_Resource_Base::rest_list in Commerce Mollie 7

Get a collection of objects from the REST API.

Parameters

$rest_resource:

int $offset:

int $limit:

Return value

Mollie_API_Object_List

1 call to Mollie_API_Resource_Base::rest_list()
Mollie_API_Resource_Base::all in Mollie/API/Resource/Base.php
Retrieve all objects of a certain resource.

File

Mollie/API/Resource/Base.php, line 101

Class

Mollie_API_Resource_Base
Copyright (c) 2013, Mollie B.V. All rights reserved.

Code

private function rest_list($rest_resource, $offset = 0, $limit = self::DEFAULT_LIMIT) {
  $api_path = $rest_resource . "?" . http_build_query(array(
    "offset" => $offset,
    "count" => $limit,
  ));
  $result = $this
    ->performApiCall(self::REST_LIST, $api_path);

  /** @var Mollie_API_Object_List $collection */
  $collection = $this
    ->copy($result, new Mollie_API_Object_List());
  foreach ($result->data as $data_result) {
    $collection[] = $this
      ->copy($data_result, $this
      ->getResourceObject());
  }
  return $collection;
}