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 Modules\Media\Image\Intervention\Manipulations; |
||
5 | View Code Duplication | class Rotate implements ImageHandlerInterface |
|
6 | { |
||
7 | private $defaults = [ |
||
8 | 'angle' => 45, |
||
9 | 'bgcolor' => '#000000', |
||
10 | ]; |
||
11 | |||
12 | /** |
||
13 | * Handle the image manipulation request |
||
14 | * @param \Intervention\Image\Image $image |
||
15 | * @param array $options |
||
16 | * @return \Intervention\Image\Image |
||
17 | */ |
||
18 | public function handle($image, $options) |
||
24 | } |
||
25 |