1<?php
2
3namespace Elastica\Aggregation;
4
5class Composite extends AbstractAggregation
6{
7    /**
8     * @return $this
9     */
10    public function setSize(int $size): self
11    {
12        return $this->setParam('size', $size);
13    }
14
15    /**
16     * @return $this
17     */
18    public function addSource(AbstractAggregation $aggregation): self
19    {
20        return $this->addParam('sources', [$aggregation]);
21    }
22
23    /**
24     * @return $this
25     */
26    public function addAfter(?array $checkpoint): self
27    {
28        if (null === $checkpoint) {
29            return $this;
30        }
31
32        return $this->setParam('after', $checkpoint);
33    }
34}
35