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 |
||
20 | View Code Duplication | class AnyPredicate extends AbstractQuantifierPredicate |
|
21 | { |
||
22 | /** |
||
23 | * Evaluates the predicate returning true if any predicate returns true. |
||
24 | * |
||
25 | * @param mixed $value The input value. |
||
26 | * @return bool true if any decorated predicate return true |
||
27 | */ |
||
28 | 6 | public function __invoke($value) : bool |
|
38 | } |
||
39 |