| Total Complexity | 4 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Nord\Lumen\Elasticsearch\Search\Aggregation\Bucket; |
||
| 12 | class GlobalAggregation extends AbstractAggregation |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var AggregationCollection |
||
| 16 | */ |
||
| 17 | private $aggregations; |
||
| 18 | |||
| 19 | |||
| 20 | /** |
||
| 21 | * Constructor. |
||
| 22 | */ |
||
| 23 | public function __construct() |
||
| 24 | { |
||
| 25 | $this->aggregations = new AggregationCollection(); |
||
| 26 | } |
||
| 27 | |||
| 28 | |||
| 29 | /** |
||
| 30 | * @inheritdoc |
||
| 31 | */ |
||
| 32 | public function toArray() |
||
| 33 | { |
||
| 34 | return [ |
||
| 35 | 'global' => new \stdClass(), |
||
| 36 | 'aggs' => $this->getAggregations()->toArray() |
||
| 37 | ]; |
||
| 38 | } |
||
| 39 | |||
| 40 | |||
| 41 | /** |
||
| 42 | * @return AggregationCollection |
||
| 43 | */ |
||
| 44 | public function getAggregations() |
||
| 45 | { |
||
| 46 | return $this->aggregations; |
||
| 47 | } |
||
| 48 | |||
| 49 | |||
| 50 | /** |
||
| 51 | * @param Aggregation $aggregation |
||
| 52 | * @return GlobalAggregation |
||
| 53 | */ |
||
| 54 | public function addAggregation(Aggregation $aggregation) |
||
| 58 | } |
||
| 59 | } |
||
| 60 |