Completed
Pull Request — master (#129)
by
unknown
03:22 queued 35s
created

AbstractPipelineAggregation   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getBucketsPath() 0 4 1
A setBucketsPath() 0 4 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)
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