These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Elastica\Aggregation; |
||
4 | |||
5 | /** |
||
6 | * Class AbstractTermsAggregation. |
||
7 | */ |
||
8 | abstract class AbstractTermsAggregation extends AbstractSimpleAggregation |
||
9 | { |
||
10 | /** |
||
11 | * Set the minimum number of documents in which a term must appear in order to be returned in a bucket. |
||
12 | * |
||
13 | * @param int $count |
||
14 | * |
||
15 | * @return $this |
||
16 | */ |
||
17 | public function setMinimumDocumentCount($count) |
||
18 | { |
||
19 | return $this->setParam('min_doc_count', $count); |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * Filter documents to include based on a regular expression. |
||
24 | * |
||
25 | * @param string $pattern a regular expression |
||
26 | * @param string $flags Java Pattern flags |
||
27 | * |
||
28 | * @return $this |
||
29 | */ |
||
30 | View Code Duplication | public function setInclude($pattern, $flags = null) |
|
0 ignored issues
–
show
|
|||
31 | { |
||
32 | if (is_null($flags)) { |
||
33 | return $this->setParam('include', $pattern); |
||
34 | } |
||
35 | |||
36 | return $this->setParam('include', [ |
||
37 | 'pattern' => $pattern, |
||
38 | 'flags' => $flags, |
||
39 | ]); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Filter documents to exclude based on a regular expression. |
||
44 | * |
||
45 | * @param string $pattern a regular expression |
||
46 | * @param string $flags Java Pattern flags |
||
47 | * |
||
48 | * @return $this |
||
49 | */ |
||
50 | View Code Duplication | public function setExclude($pattern, $flags = null) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
51 | { |
||
52 | if (is_null($flags)) { |
||
53 | return $this->setParam('exclude', $pattern); |
||
54 | } |
||
55 | |||
56 | return $this->setParam('exclude', [ |
||
57 | 'pattern' => $pattern, |
||
58 | 'flags' => $flags, |
||
59 | ]); |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * Sets the amount of terms to be returned. |
||
64 | * |
||
65 | * @param int $size the amount of terms to be returned |
||
66 | * |
||
67 | * @return $this |
||
68 | */ |
||
69 | public function setSize($size) |
||
70 | { |
||
71 | return $this->setParam('size', $size); |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * Sets how many terms the coordinating node will request from each shard. |
||
76 | * |
||
77 | * @param int $shard_size the amount of terms to be returned |
||
78 | * |
||
79 | * @return $this |
||
80 | */ |
||
81 | public function setShardSize($shard_size) |
||
82 | { |
||
83 | return $this->setParam('shard_size', $shard_size); |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * Instruct Elasticsearch to use direct field data or ordinals of the field values to execute this aggregation. |
||
88 | * The execution hint will be ignored if it is not applicable. |
||
89 | * |
||
90 | * @param string $hint map or ordinals |
||
91 | * |
||
92 | * @return $this |
||
93 | */ |
||
94 | public function setExecutionHint($hint) |
||
95 | { |
||
96 | return $this->setParam('execution_hint', $hint); |
||
97 | } |
||
98 | } |
||
99 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.