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 namespace BuildR\TestTools\Asserts; |
||
16 | class IsConstantDefinedConstraint extends \PHPUnit_Framework_Constraint { |
||
17 | |||
18 | /** |
||
19 | * {@inheritDoc} |
||
20 | */ |
||
21 | 3 | View Code Duplication | protected function matches($other) { |
32 | |||
33 | |||
34 | /** |
||
35 | * {@inheritDoc} |
||
36 | */ |
||
37 | 2 | public function toString() { |
|
40 | |||
41 | } |
||
42 |