Skip to content

Commit 8232ade

Browse files
committed
Include 'meta' fields only if it exists in API response
1 parent da59df5 commit 8232ade

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/PaymentRails/ResourceCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class ResourceCollection implements Iterator
4040
*/
4141
public function __construct($response, $items, $pager)
4242
{
43-
$this->_page = $response["meta"]["page"];
43+
$this->_page = isset($response["meta"]) ? $response["meta"]["page"] : null;
4444
$this->_items = $items;
45-
$this->_records = $response["meta"]["records"];
45+
$this->_records = isset($response["meta"]) ? $response["meta"]["records"] : null;
4646
$this->_pager = $pager;
4747
$this->_index = 0;
4848
if (isset($response["meta"]["pages"])) {

0 commit comments

Comments
 (0)