Pipeline::max()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Triadev\Es\Dsl\Dsl\Aggregation;
3
4
use ONGR\ElasticsearchDSL\Aggregation\Pipeline\BucketScriptAggregation;
5
use ONGR\ElasticsearchDSL\Aggregation\Pipeline\BucketSelectorAggregation;
6
use ONGR\ElasticsearchDSL\Aggregation\Pipeline\CumulativeSumAggregation;
7
use ONGR\ElasticsearchDSL\Aggregation\Pipeline\DerivativeAggregation;
8
use ONGR\ElasticsearchDSL\Aggregation\Pipeline\ExtendedStatsBucketAggregation;
9
use ONGR\ElasticsearchDSL\Aggregation\Pipeline\PercentilesBucketAggregation;
10
use ONGR\ElasticsearchDSL\Aggregation\Pipeline\AvgBucketAggregation;
11
use ONGR\ElasticsearchDSL\Aggregation\Pipeline\MaxBucketAggregation;
12
use ONGR\ElasticsearchDSL\Aggregation\Pipeline\MinBucketAggregation;
13
use ONGR\ElasticsearchDSL\Aggregation\Pipeline\SerialDifferencingAggregation;
14
use ONGR\ElasticsearchDSL\Aggregation\Pipeline\StatsBucketAggregation;
15
use ONGR\ElasticsearchDSL\Aggregation\Pipeline\SumBucketAggregation;
16
17
class Pipeline extends Aggs
18
{
19
    /**
20
     * Avg
21
     *
22
     * @param string $name
23
     * @param string $bucketsPath
24
     * @return Pipeline
25
     */
26 1
    public function avg(string $name, string $bucketsPath): Pipeline
27
    {
28 1
        $this->addAggregation(new AvgBucketAggregation($name, $bucketsPath));
29 1
        return $this;
30
    }
31
    
32
    /**
33
     * Max
34
     *
35
     * @param string $name
36
     * @param string $bucketsPath
37
     * @return Pipeline
38
     */
39 1
    public function max(string $name, string $bucketsPath): Pipeline
40
    {
41 1
        $this->addAggregation(new MaxBucketAggregation($name, $bucketsPath));
42 1
        return $this;
43
    }
44
    
45
    /**
46
     * Min
47
     *
48
     * @param string $name
49
     * @param string $bucketsPath
50
     * @return Pipeline
51
     */
52 1
    public function min(string $name, string $bucketsPath): Pipeline
53
    {
54 1
        $this->addAggregation(new MinBucketAggregation($name, $bucketsPath));
55 1
        return $this;
56
    }
57
    
58
    /**
59
     * Percentiles
60
     *
61
     * @param string $name
62
     * @param string $bucketsPath
63
     * @return Pipeline
64
     */
65 1
    public function percentiles(string $name, string $bucketsPath): Pipeline
66
    {
67 1
        $this->addAggregation(new PercentilesBucketAggregation($name, $bucketsPath));
68 1
        return $this;
69
    }
70
    
71
    /**
72
     * Stats
73
     *
74
     * @param string $name
75
     * @param string $bucketsPath
76
     * @return Pipeline
77
     */
78 1
    public function stats(string $name, string $bucketsPath): Pipeline
79
    {
80 1
        $this->addAggregation(new StatsBucketAggregation($name, $bucketsPath));
81 1
        return $this;
82
    }
83
    
84
    /**
85
     * Sum
86
     *
87
     * @param string $name
88
     * @param string $bucketsPath
89
     * @return Pipeline
90
     */
91 1
    public function sum(string $name, string $bucketsPath): Pipeline
92
    {
93 1
        $this->addAggregation(new SumBucketAggregation($name, $bucketsPath));
94 1
        return $this;
95
    }
96
    
97
    /**
98
     * Serial differencing
99
     *
100
     * @param string $name
101
     * @param string $bucketsPath
102
     * @return Pipeline
103
     */
104 1
    public function serialDifferencing(string $name, string $bucketsPath) : Pipeline
105
    {
106 1
        $this->addAggregation(new SerialDifferencingAggregation($name, $bucketsPath));
107 1
        return $this;
108
    }
109
    
110
    /**
111
     * Extended stats
112
     *
113
     * @param string $name
114
     * @param string $bucketsPath
115
     * @return Pipeline
116
     */
117 1
    public function extendedStats(string $name, string $bucketsPath) : Pipeline
118
    {
119 1
        $this->addAggregation(new ExtendedStatsBucketAggregation($name, $bucketsPath));
120 1
        return $this;
121
    }
122
    
123
    /**
124
     * Derivative
125
     *
126
     * @param string $name
127
     * @param string $bucketsPath
128
     * @return Pipeline
129
     */
130 1
    public function derivative(string $name, string $bucketsPath) : Pipeline
131
    {
132 1
        $this->addAggregation(new DerivativeAggregation($name, $bucketsPath));
133 1
        return $this;
134
    }
135
    
136
    /**
137
     * Cumulative sum
138
     *
139
     * @param string $name
140
     * @param string $bucketsPath
141
     * @return Pipeline
142
     */
143 1
    public function cumulativeSum(string $name, string $bucketsPath) : Pipeline
144
    {
145 1
        $this->addAggregation(new CumulativeSumAggregation($name, $bucketsPath));
146 1
        return $this;
147
    }
148
    
149
    /**
150
     * Bucket selector
151
     *
152
     * @param string $name
153
     * @param string $bucketsPath
154
     * @param string $script
155
     * @return Pipeline
156
     */
157 1
    public function bucketSelector(
158
        string $name,
159
        /** @scrutinizer ignore-type */ string $bucketsPath,
160
        string $script
161
    ) : Pipeline {
162 1
        $this->addAggregation(new BucketSelectorAggregation($name, $bucketsPath, $script));
1 ignored issue
show
Bug introduced by
$bucketsPath of type string is incompatible with the type array expected by parameter $bucketsPath of ONGR\ElasticsearchDSL\Ag...regation::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

162
        $this->addAggregation(new BucketSelectorAggregation($name, /** @scrutinizer ignore-type */ $bucketsPath, $script));
Loading history...
163 1
        return $this;
164
    }
165
    
166
    /**
167
     * Bucket
168
     *
169
     * @param string $name
170
     * @param string $bucketsPath
171
     * @param string $script
172
     * @return Pipeline
173
     */
174 1
    public function bucketScript(
175
        string $name,
176
        /** @scrutinizer ignore-type */ string $bucketsPath,
177
        string $script
178
    ) : Pipeline {
179 1
        $this->addAggregation(new BucketScriptAggregation($name, $bucketsPath, $script));
1 ignored issue
show
Bug introduced by
$bucketsPath of type string is incompatible with the type array expected by parameter $bucketsPath of ONGR\ElasticsearchDSL\Ag...regation::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

179
        $this->addAggregation(new BucketScriptAggregation($name, /** @scrutinizer ignore-type */ $bucketsPath, $script));
Loading history...
180 1
        return $this;
181
    }
182
}
183