| 1 | <?php |
||
| 8 | class Collection implements IteratorAggregate, Countable |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var \Percy\Entity\EntityInterface[] |
||
| 12 | */ |
||
| 13 | protected $entities = []; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var integer |
||
| 17 | */ |
||
| 18 | protected $total = 0; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Return api representation of collection. |
||
| 22 | * |
||
| 23 | * @param array $scopes |
||
| 24 | * |
||
| 25 | * @return array |
||
| 26 | */ |
||
| 27 | 2 | public function toArray(array $scopes = []) |
|
| 41 | |||
| 42 | /** |
||
| 43 | * Return raw array representation of data. |
||
| 44 | * |
||
| 45 | * @param array $scopes |
||
| 46 | * |
||
| 47 | * @return array |
||
| 48 | */ |
||
| 49 | 1 | public function getData(array $scopes = []) |
|
| 59 | |||
| 60 | /** |
||
| 61 | * Adds an entity to the collection. |
||
| 62 | * |
||
| 63 | * @param \Percy\Entity\EntityInterface $entity |
||
| 64 | * |
||
| 65 | * @return self |
||
| 66 | */ |
||
| 67 | 5 | public function addEntity(EntityInterface $entity) |
|
| 73 | |||
| 74 | /** |
||
| 75 | * {@inheritdoc} |
||
| 76 | */ |
||
| 77 | 6 | public function getIterator() |
|
| 85 | |||
| 86 | /** |
||
| 87 | * {@inheritdoc} |
||
| 88 | */ |
||
| 89 | 6 | public function count() |
|
| 93 | |||
| 94 | /** |
||
| 95 | * Set the total number of results relating to the collection. |
||
| 96 | * |
||
| 97 | * @param integer $total |
||
| 98 | * |
||
| 99 | * @return self |
||
| 100 | */ |
||
| 101 | 4 | public function setTotal($total) |
|
| 107 | |||
| 108 | /** |
||
| 109 | * Get the total number of results relating to the collection. |
||
| 110 | * |
||
| 111 | * @return integer |
||
| 112 | */ |
||
| 113 | 5 | public function getTotal() |
|
| 117 | } |
||
| 118 |