1 | <?php |
||
23 | class TopHitsAggregation extends AbstractAggregation |
||
24 | { |
||
25 | use MetricTrait; |
||
26 | |||
27 | /** |
||
28 | * @var int Number of top matching hits to return per bucket. |
||
29 | */ |
||
30 | private $size; |
||
31 | |||
32 | /** |
||
33 | * @var int The offset from the first result you want to fetch. |
||
34 | */ |
||
35 | private $from; |
||
36 | |||
37 | /** |
||
38 | * @var BuilderInterface How the top matching hits should be sorted. |
||
39 | */ |
||
40 | private $sort; |
||
41 | |||
42 | /** |
||
43 | * Constructor for top hits. |
||
44 | * |
||
45 | * @param string $name Aggregation name. |
||
46 | * @param null|int $size Number of top matching hits to return per bucket. |
||
47 | * @param null|int $from The offset from the first result you want to fetch. |
||
48 | * @param null|BuilderInterface $sort How the top matching hits should be sorted. |
||
49 | */ |
||
50 | public function __construct($name, $size = null, $from = null, $sort = null) |
||
57 | |||
58 | /** |
||
59 | * Return from. |
||
60 | * |
||
61 | * @return int |
||
62 | */ |
||
63 | public function getFrom() |
||
67 | |||
68 | /** |
||
69 | * Set from. |
||
70 | * |
||
71 | * @param int $from |
||
72 | */ |
||
73 | public function setFrom($from) |
||
77 | |||
78 | /** |
||
79 | * Return sort. |
||
80 | * |
||
81 | * @return BuilderInterface |
||
82 | */ |
||
83 | public function getSort() |
||
87 | |||
88 | /** |
||
89 | * Set sort. |
||
90 | * |
||
91 | * @param BuilderInterface $sort |
||
92 | */ |
||
93 | public function setSort($sort) |
||
97 | |||
98 | /** |
||
99 | * Set size. |
||
100 | * |
||
101 | * @param int $size |
||
102 | */ |
||
103 | public function setSize($size) |
||
107 | |||
108 | /** |
||
109 | * Return size. |
||
110 | * |
||
111 | * @return int |
||
112 | */ |
||
113 | public function getSize() |
||
117 | |||
118 | /** |
||
119 | * {@inheritdoc} |
||
120 | */ |
||
121 | public function getType() |
||
125 | |||
126 | /** |
||
127 | * {@inheritdoc} |
||
128 | */ |
||
129 | public function getArray() |
||
146 | } |
||
147 |
It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null.
We recommend to add an additional type check (or disallow null for the parameter):