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 |
||
| 14 | class ClassifiersResponseTest extends Base |
||
| 15 | { |
||
| 16 | protected $images = array('cosmos-flower-433424_640.jpg', 'hummingbird-1047836_640.jpg'); |
||
| 17 | |||
| 18 | protected $classifiers = [ |
||
| 19 | "Black" => "Black", |
||
| 20 | "Blue" => "Blue", |
||
| 21 | "Brown" => "Brown", |
||
| 22 | "Cyan" => "Cyan", |
||
| 23 | "Green" => "Green", |
||
| 24 | "Magenta" => "Magenta", |
||
| 25 | "Mixed_Color" => "Mixed_Color", |
||
| 26 | "Orange" => "Orange", |
||
| 27 | "Red" => "Red", |
||
| 28 | "Violet" => "Violet", |
||
| 29 | "White" => "White", |
||
| 30 | "Yellow" => "Yellow", |
||
| 31 | "Black_and_white" => "Black_and_white", |
||
| 32 | "Color" => "Color", |
||
| 33 | ]; |
||
| 34 | |||
| 35 | View Code Duplication | public function testSuccess() |
|
| 53 | |||
| 54 | /** |
||
| 55 | * Test versbose response |
||
| 56 | */ |
||
| 57 | View Code Duplication | public function testVerbose() |
|
| 76 | } |
||
| 77 |