Completed
Push — master ( 1dc07a...7a30c1 )
by Simonas
03:05 queued 17s
created

PercentilesBucketAggregation   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 45
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 4 1
A getPercents() 0 4 1
A setPercents() 0 4 1
A getArray() 0 10 2
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\ElasticsearchDSL\Aggregation\Pipeline;
13
14
/**
15
 * Class representing Percentiles Bucket Pipeline Aggregation.
16
 *
17
 * @link https://goo.gl/bqi7m5
18
 */
19
class PercentilesBucketAggregation extends AbstractPipelineAggregation
20
{
21
    /**
22
     * @var array
23
     */
24
    private $percents;
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function getType()
30
    {
31
        return 'percentiles_bucket';
32
    }
33
34
    /**
35
     * @return array
36
     */
37
    public function getPercents()
38
    {
39
        return $this->percents;
40
    }
41
42
    /**
43
     * @param array $percents
44
     */
45
    public function setPercents(array $percents)
46
    {
47
        $this->percents = $percents;
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function getArray()
54
    {
55
        $data = ['buckets_path' => $this->getBucketsPath()];
56
57
        if ($this->getPercents()) {
58
            $data['percents'] = $this->getPercents();
59
        }
60
61
        return $data;
62
    }
63
}
64