1 | <?php |
||
22 | abstract class AbstractAggregation implements NamedBuilderInterface |
||
23 | { |
||
24 | use ParametersTrait; |
||
25 | use NameAwareTrait; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $field; |
||
31 | |||
32 | /** |
||
33 | * @var BuilderBag |
||
34 | */ |
||
35 | private $aggregations; |
||
36 | |||
37 | /** |
||
38 | * Abstract supportsNesting method. |
||
39 | * |
||
40 | * @return bool |
||
41 | */ |
||
42 | abstract protected function supportsNesting(); |
||
43 | |||
44 | /** |
||
45 | * @return array|\stdClass |
||
46 | */ |
||
47 | abstract protected function getArray(); |
||
48 | |||
49 | /** |
||
50 | * Inner aggregations container init. |
||
51 | * |
||
52 | * @param string $name |
||
53 | */ |
||
54 | public function __construct($name) |
||
58 | |||
59 | /** |
||
60 | * @param string $field |
||
61 | * |
||
62 | * @return $this |
||
63 | */ |
||
64 | public function setField($field) |
||
70 | |||
71 | /** |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getField() |
||
78 | |||
79 | /** |
||
80 | * Adds a sub-aggregation. |
||
81 | * |
||
82 | * @param AbstractAggregation $abstractAggregation |
||
83 | * |
||
84 | * @return $this |
||
85 | */ |
||
86 | public function addAggregation(AbstractAggregation $abstractAggregation) |
||
96 | |||
97 | /** |
||
98 | * Returns all sub aggregations. |
||
99 | * |
||
100 | * @return BuilderBag[]|NamedBuilderInterface[] |
||
101 | */ |
||
102 | public function getAggregations() |
||
110 | |||
111 | /** |
||
112 | * Returns sub aggregation. |
||
113 | * @param string $name Aggregation name to return. |
||
114 | * |
||
115 | * @return AbstractAggregation|NamedBuilderInterface|null |
||
116 | */ |
||
117 | public function getAggregation($name) |
||
125 | |||
126 | /** |
||
127 | * {@inheritdoc} |
||
128 | */ |
||
129 | public function toArray() |
||
146 | |||
147 | /** |
||
148 | * Process all nested aggregations. |
||
149 | * |
||
150 | * @return array |
||
151 | */ |
||
152 | protected function collectNestedAggregations() |
||
162 | |||
163 | /** |
||
164 | * Creates BuilderBag new instance. |
||
165 | * |
||
166 | * @return BuilderBag |
||
167 | */ |
||
168 | private function createBuilderBag() |
||
172 | } |
||
173 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: