Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/PaymentRails/ResourceCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ class ResourceCollection implements Iterator
*/
public function __construct($response, $items, $pager)
{
$this->_page = $response["meta"]["page"];
// Add "meta" fields only when they exist in JSON response
$this->_page = isset($response["meta"]) ? $response["meta"]["page"] : null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which PHP version are we using?
if php7+, we can use null coalescing.$response["meta"]["page"] ?? null

$this->_items = $items;
$this->_records = $response["meta"]["records"];
$this->_records = isset($response["meta"]) ? $response["meta"]["records"] : null;
$this->_pager = $pager;
$this->_index = 0;
if (isset($response["meta"]["pages"])) {
Expand Down
4 changes: 2 additions & 2 deletions lib/PaymentRails/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class Version
* class constants
*/
const MAJOR = 2;
const MINOR = 2;
const TINY = 0;
const MINOR = 1;
const TINY = 4;

/**
* @ignore
Expand Down