Completed
Pull Request — master (#126)
by
unknown
03:19
created

AbstractPipelineAggregation::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace ONGR\ElasticsearchDSL\Aggregation\Pipeline;
4
5
use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
6
use ONGR\ElasticsearchDSL\Aggregation\Type\MetricTrait;
7
8
abstract class AbstractPipelineAggregation extends AbstractAggregation
9
{
10
    use MetricTrait;
11
12
    /**
13
     * @var string
14
     */
15
    private $bucketsPath;
16
17
    /**
18
     * @param string $name
19
     * @param $bucketsPath
20
     */
21
    public function __construct($name, $bucketsPath)
22
    {
23
        parent::__construct($name);
24
        $this->setBucketsPath($bucketsPath);
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function getBucketsPath()
31
    {
32
        return $this->bucketsPath;
33
    }
34
35
    /**
36
     * @param string $bucketsPath
37
     */
38
    public function setBucketsPath($bucketsPath)
39
    {
40
        $this->bucketsPath = $bucketsPath;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function getArray()
47
    {
48
        return ['buckets_path' => $this->getBucketsPath()];
49
    }
50
}
51