| Total Complexity | 10 |
| Total Lines | 87 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Nord\Lumen\Elasticsearch\Search\Aggregation; |
||
| 5 | class AggregationCollection implements \Countable, \IteratorAggregate, Arrayable |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var Aggregation[] |
||
| 9 | */ |
||
| 10 | private $aggregations = []; |
||
| 11 | |||
| 12 | |||
| 13 | /** |
||
| 14 | * @param array $aggregations |
||
| 15 | */ |
||
| 16 | public function __construct(array $aggregations = []) |
||
| 17 | { |
||
| 18 | foreach ($aggregations as $aggregation) { |
||
| 19 | $this->add($aggregation); |
||
| 20 | } |
||
| 21 | } |
||
| 22 | |||
| 23 | |||
| 24 | /** |
||
| 25 | * @return array |
||
| 26 | */ |
||
| 27 | public function toArray() |
||
| 36 | } |
||
| 37 | |||
| 38 | |||
| 39 | /** |
||
| 40 | * {@inheritdoc} |
||
| 41 | */ |
||
| 42 | public function count() |
||
| 43 | { |
||
| 44 | return count($this->aggregations); |
||
| 45 | } |
||
| 46 | |||
| 47 | |||
| 48 | /** |
||
| 49 | * {@inheritdoc} |
||
| 50 | */ |
||
| 51 | public function getIterator() |
||
| 54 | } |
||
| 55 | |||
| 56 | |||
| 57 | /** |
||
| 58 | * @param Aggregation $aggregation |
||
| 59 | * @return AggregationCollection |
||
| 60 | */ |
||
| 61 | public function add(Aggregation $aggregation) |
||
| 62 | { |
||
| 63 | $this->aggregations[] = $aggregation; |
||
| 64 | return $this; |
||
| 65 | } |
||
| 66 | |||
| 67 | |||
| 68 | /** |
||
| 69 | * @param int $index |
||
| 70 | * @return Aggregation|null |
||
| 71 | */ |
||
| 72 | public function remove($index) |
||
| 82 | } |
||
| 83 | |||
| 84 | |||
| 85 | /** |
||
| 86 | * @param int $index |
||
| 87 | * @return Aggregation|null |
||
| 88 | */ |
||
| 89 | public function get($index) |
||
| 94 |