Completed
Push — master ( d3ac62...0cb203 )
by Federico
02:08
created

lib/Elastica/Aggregation/BucketSelector.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Elastica\Aggregation;
4
5
/**
6
 * Class BucketSelector.
7
 *
8
 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-selector-aggregation.html
9
 */
10
class BucketSelector extends AbstractSimpleAggregation
11
{
12
    /**
13
     * @param string      $name
14
     * @param array|null  $bucketsPath
15
     * @param string|null $script
16
     */
17 View Code Duplication
    public function __construct(string $name, array $bucketsPath = null, string $script = null)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
    {
19
        parent::__construct($name);
20
21
        if (null !== $bucketsPath) {
22
            $this->setBucketsPath($bucketsPath);
23
        }
24
25
        if (null !== $script) {
26
            $this->setScript($script);
27
        }
28
    }
29
30
    /**
31
     * Set the buckets_path for this aggregation.
32
     *
33
     * @param array $bucketsPath
34
     *
35
     * @return $this
36
     */
37
    public function setBucketsPath($bucketsPath)
38
    {
39
        return $this->setParam('buckets_path', $bucketsPath);
40
    }
41
42
    /**
43
     * Set the gap policy for this aggregation.
44
     *
45
     * @param string $gapPolicy
46
     *
47
     * @return $this
48
     */
49
    public function setGapPolicy(string $gapPolicy = 'skip')
50
    {
51
        return $this->setParam('gap_policy', $gapPolicy);
52
    }
53
}
54