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 |
||
11 | class FetchEntity |
||
12 | { |
||
13 | /** |
||
14 | * @param array|object $jobData |
||
15 | * @throws \InvalidArgumentException |
||
16 | */ |
||
17 | 2 | View Code Duplication | public function __construct($jobData = []) |
29 | |||
30 | /** @var string */ |
||
31 | public $uri = ''; |
||
32 | |||
33 | /** @var string */ |
||
34 | public $destPath = ''; |
||
35 | |||
36 | /** @var bool */ |
||
37 | public $extract = false; |
||
38 | |||
39 | /** @var bool */ |
||
40 | public $cache = false; |
||
41 | |||
42 | /** @var bool */ |
||
43 | public $executable = false; |
||
44 | } |
||
45 |