1<?php
2
3namespace Elastica\Aggregation;
4
5/**
6 * Class CumulativeSum.
7 *
8 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-cumulative-sum-aggregation.html
9 */
10class CumulativeSum extends AbstractAggregation
11{
12    use Traits\BucketsPathTrait;
13
14    public function __construct(string $name, string $bucketsPath)
15    {
16        parent::__construct($name);
17
18        $this->setBucketsPath($bucketsPath);
19    }
20
21    /**
22     * Set the format for this aggregation.
23     *
24     * @return $this
25     */
26    public function setFormat(?string $format = null): self
27    {
28        return $this->setParam('format', $format);
29    }
30}
31