CursorSubset<T>
A wrapper around a Traversable that includes the total count of the superset.
class CursorSubset<T> extends IteratorIterator<T> implements JsonSerializable- Copyright
- 2015-2016 Appertly
- License
- Apache-2.0
Constructors / Destructors
| Returns | Signature and Description |
|---|---|
void | __construct(, )Create a new CursorSubset. |
Instance Methods
| Returns | Signature and Description |
|---|---|
int | getTotal()Gets the superset total. |
mixed | Return data which can be serialized with json_encode. |
array<T> | toArray()Converts this thing into an array. |
Method Details
__construct
public function
__construct(Traversable<T> $iterable, int $total)Create a new CursorSubset.
| Name | Type | Description |
|---|---|---|
$iterable | Traversable<T> | The traversable to wrap |
$total | int | The total number of items in the superset |
| Type | Conditions |
|---|---|
RangeException | if the total is negative |
getTotal
public function
getTotal()Gets the superset total.
| Type | Description |
|---|---|
int | The total number of items in the superset (never negative). |
jsonSerialize
public function
jsonSerialize()Return data which can be serialized with json_encode.
| Type | Description |
|---|---|
mixed |
toArray
public function
toArray()Converts this thing into an array.
| Type | Description |
|---|---|
array<T> | The array version of this thing |