1: <?php
2: namespace Ctct\Components;
3:
4: /**
5: * Container for a get on a collection, such as Contacts, Campaigns, or TrackingData.
6: *
7: */
8: class ResultSet
9: {
10: /**
11: * array of result objects returned
12: * @var array
13: */
14: public $results = array();
15:
16: /**
17: * next link returned from a get on a collection if one exists
18: * @var string
19: */
20: public $next;
21:
22: /**
23: * Constructor to create a ResultSet from the results/meta response when performing a get on a collection
24: * @param array $results - results array from request
25: * @param array $meta - meta array from request
26: */
27: public function __construct(array $results, array $meta)
28: {
29: $this->results = $results;
30:
31: if (array_key_exists('next_link', $meta['pagination'])) {
32: $nextLink = $meta['pagination']['next_link'];
33: $this->next = substr($nextLink, strpos($nextLink, '?') + 6);
34: }
35: }
36: }
37: