1 | <?php |
||
24 | final class PagedList |
||
25 | { |
||
26 | /** |
||
27 | * The paged list items. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | private $items; |
||
32 | |||
33 | /** |
||
34 | * The url for retrieving the next set of items. |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | private $nextUrl; |
||
39 | |||
40 | /** |
||
41 | * Creates a new paged list. |
||
42 | * |
||
43 | * @param array $items The paged list items. |
||
44 | * @param string $nextUrl The url for retrieving the next set of items. |
||
45 | */ |
||
46 | 26 | public function __construct(array $items = array(), $nextUrl = null) |
|
53 | |||
54 | /** |
||
55 | * Returns the items. |
||
56 | * |
||
57 | * @return array The items. |
||
58 | */ |
||
59 | 8 | public function items() |
|
63 | |||
64 | /** |
||
65 | * Returns whether the paged list has more items. |
||
66 | * |
||
67 | * @return bool Whether there are more items. |
||
68 | */ |
||
69 | 4 | public function hasNext() |
|
73 | |||
74 | /** |
||
75 | * Returns the url to get the next set of items. |
||
76 | * |
||
77 | * @return string The url to get the next set of items. |
||
78 | */ |
||
79 | 2 | public function getNextUrl() |
|
83 | |||
84 | /** |
||
85 | * Checks if all items are pinterest objects. |
||
86 | * |
||
87 | * @param array $items |
||
88 | * |
||
89 | * @throws InvalidArgumentException |
||
90 | */ |
||
91 | 26 | private function guardThatTheseAreAllPinterestObjects(array $items) |
|
102 | |||
103 | /** |
||
104 | * Checks if the next uri is valid. |
||
105 | * |
||
106 | * @throws InvalidArgumentException |
||
107 | * |
||
108 | * @param $nextUri |
||
109 | */ |
||
110 | 20 | private function assertValidUri($nextUri) |
|
122 | } |
||
123 |