Passed
Branch master (8cb5b2)
by Christopher
04:33 queued 12s
created

Bucketing   A

Complexity

Total Complexity 27

Size/Duplication

Total Lines 358
Duplicated Lines 0 %

Test Coverage

Coverage 96.91%

Importance

Changes 0
Metric Value
eloc 89
dl 0
loc 358
ccs 94
cts 97
cp 0.9691
rs 10
c 0
b 0
f 0
wmc 27

17 Methods

Rating   Name   Duplication   Size   Complexity  
A missing() 0 4 1
A terms() 0 4 1
A children() 0 13 2
A nested() 0 12 3
A geoHashGrid() 0 15 1
A range() 0 4 1
A geoDistance() 0 17 1
A histogram() 0 23 1
A filter() 0 12 3
A ipv4Range() 0 8 1
A diversifiedSampler() 0 4 1
A significantTerms() 0 4 1
A reverseNested() 0 3 1
A sampler() 0 12 3
A filters() 0 13 3
A dateRange() 0 8 1
A dateHistogram() 0 23 2
1
<?php
0 ignored issues
show
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
2
namespace Triadev\Leopard\Business\Dsl\Aggregation;
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\ChildrenAggregation;
5
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\DateHistogramAggregation;
6
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\DateRangeAggregation;
7
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\DiversifiedSamplerAggregation;
8
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\FilterAggregation;
9
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\FiltersAggregation;
10
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\GeoDistanceAggregation;
11
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\GeoHashGridAggregation;
12
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\HistogramAggregation;
13
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\Ipv4RangeAggregation;
14
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\MissingAggregation;
15
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\NestedAggregation;
16
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\RangeAggregation;
17
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\SamplerAggregation;
18
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\SignificantTermsAggregation;
19
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\TermsAggregation;
20
use ONGR\ElasticsearchDSL\BuilderInterface;
21
22
class Bucketing extends Aggs
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
23
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class Bucketing
Loading history...
24
    /**
25
     * Children
26
     *
27
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
28
     * @param string $children
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
29
     * @param \Closure $bucketing
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
30
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
31
     */
32 1
    public function children(string $name, string $children, \Closure $bucketing) : Bucketing
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
33
    {
34 1
        $resultAgg = new ChildrenAggregation($name, $children);
35
        
36 1
        $bucketingBuilder = new self();
37 1
        $bucketing($bucketingBuilder);
38
        
39 1
        foreach ($bucketingBuilder->getAggregations() as $agg) {
40 1
            $resultAgg->addAggregation($agg);
41
        }
42
        
43 1
        $this->addAggregation($resultAgg);
44 1
        return $this;
45
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end children()
Loading history...
46
    
47
    /**
48
     * Date histogram
49
     *
50
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
51
     * @param string $field
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
52
     * @param string $interval
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
53
     * @param string|null $format
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
54
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
55
     *
56
     * @throws \InvalidArgumentException
0 ignored issues
show
introduced by
Comment missing for @throws tag in function comment
Loading history...
57
     */
58 1
    public function dateHistogram(
59
        string $name,
60
        string $field,
61
        string $interval,
62
        ?string $format = null
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$format" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$format"; expected 0 but found 1
Loading history...
63
    ) : Bucketing {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
64
        $validInterval = [
65 1
            'year',
1 ignored issue
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 26 spaces, but found 12.
Loading history...
66
            'quarter',
1 ignored issue
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 26 spaces, but found 12.
Loading history...
67
            'month',
1 ignored issue
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 26 spaces, but found 12.
Loading history...
68
            'week',
1 ignored issue
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 26 spaces, but found 12.
Loading history...
69
            'day',
1 ignored issue
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 26 spaces, but found 12.
Loading history...
70
            'hour',
1 ignored issue
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 26 spaces, but found 12.
Loading history...
71
            'minute',
1 ignored issue
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 26 spaces, but found 12.
Loading history...
72
            'second'
0 ignored issues
show
Coding Style introduced by
There should be a trailing comma after the last value of an array declaration.
Loading history...
73
        ];
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 25 space(s), but found 8.
Loading history...
74
        
75 1
        if (!in_array($interval, $validInterval)) {
0 ignored issues
show
Coding Style introduced by
There must be a single space after a NOT operator; 0 found
Loading history...
76
            throw new \InvalidArgumentException();
77
        }
78
        
79 1
        $this->addAggregation(new DateHistogramAggregation($name, $field, $interval, $format));
80 1
        return $this;
81
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end dateHistogram()
Loading history...
82
    
83
    /**
84
     * Date range
85
     *
86
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
87
     * @param string $field
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
88
     * @param string $format
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
89
     * @param array $ranges
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
90
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
91
     */
92 1
    public function dateRange(
93
        string $name,
94
        string $field,
95
        string $format,
96
        array $ranges = []
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$ranges" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$ranges"; expected 0 but found 1
Loading history...
97
    ) : Bucketing {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
98 1
        $this->addAggregation(new DateRangeAggregation($name, $field, $format, $ranges));
99 1
        return $this;
100
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end dateRange()
Loading history...
101
    
102
    /**
103
     * Diversified sampler
104
     *
105
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
106
     * @param string $field
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
107
     * @param int|null $shardSize
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected "integer|null" but found "int|null" for parameter type
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
108
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
109
     */
110 1
    public function diversifiedSampler(string $name, string $field, ?int $shardSize = null) : Bucketing
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$shardSize" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$shardSize"; expected 0 but found 1
Loading history...
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 103 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
111
    {
112 1
        $this->addAggregation(new DiversifiedSamplerAggregation($name, $field, $shardSize));
113 1
        return $this;
114
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end diversifiedSampler()
Loading history...
115
    
116
    /**
117
     * Filter
118
     *
119
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 13 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
120
     * @param BuilderInterface $aggregation
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
121
     * @param BuilderInterface[] $aggregations
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
122
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
123
     */
124 1
    public function filter(string $name, BuilderInterface $aggregation, array $aggregations) : Bucketing
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 104 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
125
    {
126 1
        $agg = new FilterAggregation($name, $aggregation);
127
        
128 1
        foreach ($aggregations as $a) {
129 1
            if ($a instanceof BuilderInterface) {
130 1
                $agg->addAggregation($a);
131
            }
132
        }
133
        
134 1
        $this->addAggregation($agg);
135 1
        return $this;
136
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end filter()
Loading history...
137
    
138
    /**
139
     * Filters
140
     *
141
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 13 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
142
     * @param BuilderInterface[] $filters
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
143
     * @param BuilderInterface[] $aggregations
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
144
     * @param bool $anonymous
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 15 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Expected "boolean" but found "bool" for parameter type
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
145
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
146
     */
147 1
    public function filters(string $name, array $filters, array $aggregations, bool $anonymous = false) : Bucketing
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$anonymous" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$anonymous"; expected 0 but found 1
Loading history...
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 115 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
148
    {
149 1
        $agg = new FiltersAggregation($name, $filters, $anonymous);
150
    
151 1
        foreach ($aggregations as $a) {
152 1
            if ($a instanceof BuilderInterface) {
153 1
                $agg->addAggregation($a);
154
            }
155
        }
156
    
157 1
        $this->addAggregation($agg);
158
        
159 1
        return $this;
160
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end filters()
Loading history...
161
    
162
    /**
163
     * Geo distance
164
     *
165
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
166
     * @param string $field
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
167
     * @param string $origin
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
168
     * @param array $ranges
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 7 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
169
     * @param string|null $unit
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
170
     * @param string|null $distanceType
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
171
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
172
     */
173 1
    public function geoDistance(
174
        string $name,
175
        string $field,
176
        string $origin,
177
        array $ranges = [],
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$ranges" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$ranges"; expected 0 but found 1
Loading history...
178
        string $unit = null,
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$unit" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$unit"; expected 0 but found 1
Loading history...
179
        string $distanceType = null
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$distanceType" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$distanceType"; expected 0 but found 1
Loading history...
180
    ) : Bucketing {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
181 1
        $this->addAggregation(new GeoDistanceAggregation(
1 ignored issue
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
182 1
            $name,
183 1
            $field,
184 1
            $origin,
185 1
            $ranges,
186 1
            $unit,
187 1
            $distanceType
188
        ));
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
189 1
        return $this;
190
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end geoDistance()
Loading history...
191
    
192
    /**
193
     * Geo hash grid
194
     *
195
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
196
     * @param string $field
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
197
     * @param int|null $precision
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected "integer|null" but found "int|null" for parameter type
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
198
     * @param int|null $size
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected "integer|null" but found "int|null" for parameter type
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
199
     * @param int|null $shardSize
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected "integer|null" but found "int|null" for parameter type
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
200
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
201
     */
202 1
    public function geoHashGrid(
203
        string $name,
204
        string $field,
205
        ?int $precision = null,
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$precision" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$precision"; expected 0 but found 1
Loading history...
206
        ?int $size = null,
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$size" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$size"; expected 0 but found 1
Loading history...
207
        ?int $shardSize = null
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$shardSize" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$shardSize"; expected 0 but found 1
Loading history...
208
    ) : Bucketing {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
209 1
        $this->addAggregation(new GeoHashGridAggregation(
1 ignored issue
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
210 1
            $name,
211 1
            $field,
212 1
            $precision,
213 1
            $size,
214 1
            $shardSize
215
        ));
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
216 1
        return $this;
217
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end geoHashGrid()
Loading history...
218
    
219
    /**
220
     * Histogram
221
     *
222
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
223
     * @param string $field
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
224
     * @param int $interval
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 9 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Expected "integer" but found "int" for parameter type
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
225
     * @param int|null $minDocCount
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Expected "integer|null" but found "int|null" for parameter type
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
226
     * @param string|null $orderMode
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
227
     * @param string $orderDirection
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
228
     * @param int|null $extendedBoundsMin
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Expected "integer|null" but found "int|null" for parameter type
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
229
     * @param int|null $extendedBoundsMax
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Expected "integer|null" but found "int|null" for parameter type
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
230
     * @param bool|null $keyed
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Expected "boolean|null" but found "bool|null" for parameter type
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
231
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
232
     */
233 1
    public function histogram(
234
        string $name,
235
        string $field,
236
        int $interval,
237
        ?int $minDocCount = null,
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$minDocCount" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$minDocCount"; expected 0 but found 1
Loading history...
238
        ?string $orderMode = null,
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$orderMode" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$orderMode"; expected 0 but found 1
Loading history...
239
        string $orderDirection = HistogramAggregation::DIRECTION_ASC,
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$orderDirection" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$orderDirection"; expected 0 but found 1
Loading history...
240
        ?int $extendedBoundsMin = null,
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$extendedBoundsMin" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$extendedBoundsMin"; expected 0 but found 1
Loading history...
241
        ?int $extendedBoundsMax = null,
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$extendedBoundsMax" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$extendedBoundsMax"; expected 0 but found 1
Loading history...
242
        bool $keyed = null
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$keyed" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$keyed"; expected 0 but found 1
Loading history...
243
    ) : Bucketing {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
244 1
        $this->addAggregation(new HistogramAggregation(
1 ignored issue
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
245 1
            $name,
246 1
            $field,
247 1
            $interval,
248 1
            $minDocCount,
249 1
            $orderMode,
250 1
            $orderDirection,
251 1
            $extendedBoundsMin,
252 1
            $extendedBoundsMax,
253 1
            $keyed
254
        ));
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
255 1
        return $this;
256
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end histogram()
Loading history...
257
    
258
    /**
259
     * Ipv4
260
     *
261
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
262
     * @param string $field
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
263
     * @param array $ranges
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
264
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
265
     */
266 1
    public function ipv4Range(string $name, string $field, array $ranges = []) : Bucketing
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$ranges" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$ranges"; expected 0 but found 1
Loading history...
267
    {
268 1
        $this->addAggregation(new Ipv4RangeAggregation(
1 ignored issue
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
269 1
            $name,
270 1
            $field,
271 1
            $ranges
272
        ));
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
273 1
        return $this;
274
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end ipv4Range()
Loading history...
275
    
276
    /**
277
     * Missing
278
     *
279
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
280
     * @param string $field
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
281
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
282
     */
283 1
    public function missing(string $name, string $field) : Bucketing
284
    {
285 1
        $this->addAggregation(new MissingAggregation($name, $field));
286 1
        return $this;
287
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end missing()
Loading history...
288
    
289
    /**
290
     * Nested
291
     *
292
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
293
     * @param string $path
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
294
     * @param array $aggregations
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
295
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
296
     */
297 1
    public function nested(string $name, string $path, array $aggregations = []) : Bucketing
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$aggregations" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$aggregations"; expected 0 but found 1
Loading history...
298
    {
299 1
        $agg = new NestedAggregation($name, $path);
300
        
301 1
        foreach ($aggregations as $aggregation) {
302 1
            if ($aggregation instanceof BuilderInterface) {
303 1
                $agg->addAggregation($aggregation);
304
            }
305
        }
306
        
307 1
        $this->addAggregation($agg);
308 1
        return $this;
309
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end nested()
Loading history...
310
    
311
    /**
312
     * Range
313
     *
314
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
315
     * @param string $field
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
316
     * @param array $ranges
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
317
     * @param bool $keyed
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Expected "boolean" but found "bool" for parameter type
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
318
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
319
     */
320 1
    public function range(string $name, string $field, array $ranges = [], bool $keyed = false) : Bucketing
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$ranges" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$ranges"; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between argument "$keyed" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$keyed"; expected 0 but found 1
Loading history...
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 107 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
321
    {
322 1
        $this->addAggregation(new RangeAggregation($name, $field, $ranges, $keyed));
323 1
        return $this;
324
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end range()
Loading history...
325
    
326
    public function reverseNested() : Bucketing
0 ignored issues
show
Coding Style introduced by
Missing function doc comment
Loading history...
327
    {
328
        return $this;
329
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end reverseNested()
Loading history...
330
    
331
    /**
332
     * Sampler
333
     *
334
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
335
     * @param string $field
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
336
     * @param int|null $shardSize
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected "integer|null" but found "int|null" for parameter type
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
337
     * @param array $aggregations
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
338
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
339
     */
340 1
    public function sampler(string $name, string $field, ?int $shardSize = null, array $aggregations = []) : Bucketing
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$shardSize" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$shardSize"; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between argument "$aggregations" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$aggregations"; expected 0 but found 1
Loading history...
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 118 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
341
    {
342 1
        $agg = new SamplerAggregation($name, $field, $shardSize);
343
        
344 1
        foreach ($aggregations as $aggregation) {
345 1
            if ($aggregation instanceof BuilderInterface) {
346 1
                $agg->addAggregation($aggregation);
347
            }
348
        }
349
        
350 1
        $this->addAggregation($agg);
351 1
        return $this;
352
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end sampler()
Loading history...
353
    
354
    /**
355
     * Significant terms
356
     *
357
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
358
     * @param string $field
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
359
     * @param string|null $script
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
360
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
361
     */
362 1
    public function significantTerms(string $name, string $field, ?string $script = null) : Bucketing
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$script" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$script"; expected 0 but found 1
Loading history...
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 101 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
363
    {
364 1
        $this->addAggregation(new SignificantTermsAggregation($name, $field, $script));
365 1
        return $this;
366
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end significantTerms()
Loading history...
367
    
368
    /**
369
     * Terms
370
     *
371
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
372
     * @param string|null $field
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
373
     * @param string|null $script
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
374
     * @return Bucketing
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
375
     */
376 2
    public function terms(string $name, ?string $field = null, ?string $script = null) : Bucketing
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$field" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$field"; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between argument "$script" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$script"; expected 0 but found 1
Loading history...
377
    {
378 2
        $this->addAggregation(new TermsAggregation($name, $field, $script));
379 2
        return $this;
380
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end terms()
Loading history...
381
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
382