<?php namespace Ctct\Components; class ResultSet { public $results = array(); public $next; public function __construct(array $results, array $meta) { $this->results = $results; if (array_key_exists('next_link', $meta['pagination'])) { $nextLink = $meta['pagination']['next_link']; $this->next = substr($nextLink, strpos($nextLink, '?') + 6); } } } 