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 |
||
24 | class Dropbox extends Remote implements Collector |
||
25 | { |
||
26 | /** |
||
27 | * @var DropboxApi |
||
28 | */ |
||
29 | protected $client; |
||
30 | |||
31 | /** |
||
32 | * OpenStack constructor. |
||
33 | * |
||
34 | * @param \phpbu\App\Backup\Target $target |
||
35 | * @param \phpbu\App\Backup\Path $path |
||
36 | * @param \Kunnu\Dropbox\Dropbox $client |
||
37 | */ |
||
38 | public function __construct(Target $target, Path $path, DropboxApi $client) |
||
43 | |||
44 | /** |
||
45 | * Collect all created backups. |
||
46 | 1 | */ |
|
47 | protected function collectBackups() |
||
69 | } |
||
70 |