AbstractPipelineAggregation   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 47
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getBucketsPath() 0 4 1
A setBucketsPath() 0 6 1
A getArray() 0 4 1
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 = null)
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
     * @return $this
39
     */
40
    public function setBucketsPath($bucketsPath)
41
    {
42
        $this->bucketsPath = $bucketsPath;
43
44
        return $this;
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function getArray()
51
    {
52
        return ['buckets_path' => $this->getBucketsPath()];
53
    }
54
}
55