Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | <?php |
||
19 | class MultiDynamicAggregate extends DynamicAggregate |
||
20 | { |
||
21 | /** |
||
22 | * {@inheritdoc} |
||
23 | */ |
||
24 | public function getState(Request $request) |
||
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | public function modifySearch(Search $search, FilterState $state = null, SearchRequest $request = null) |
||
47 | |||
48 | /** |
||
49 | * A method used to add an additional filter to the aggregations |
||
50 | * in preProcessSearch |
||
51 | * |
||
52 | * @param FilterAggregation $filterAggregation |
||
53 | * @param NestedAggregation $deepLevelAggregation |
||
54 | * @param array $terms Terms of additional filter |
||
55 | * @param string $aggName |
||
56 | * |
||
57 | * @return BuilderInterface |
||
58 | */ |
||
59 | protected function addSubFilterAggregation( |
||
78 | |||
79 | /** |
||
80 | * @param string $key |
||
81 | * @param string $name |
||
82 | * @param ViewData $data |
||
83 | * @param bool $active True when the choice is active |
||
84 | * |
||
85 | * @return array |
||
86 | */ |
||
87 | protected function getOptionUrlParameters($key, $name, ViewData $data, $active) |
||
107 | |||
108 | /** |
||
109 | * Returns whether choice with the specified key is active. |
||
110 | * |
||
111 | * @param string $key |
||
112 | * @param ViewData $data |
||
113 | * @param string $activeName |
||
114 | * |
||
115 | * @return bool |
||
116 | */ |
||
117 | View Code Duplication | protected function isChoiceActive($key, ViewData $data, $activeName) |
|
129 | |||
130 | /** |
||
131 | * @param array $terms |
||
132 | * |
||
133 | * @return BoolQuery |
||
134 | */ |
||
135 | private function getFilterQuery($terms) |
||
161 | } |
||
162 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.