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 |
||
6 | class Dns extends \PleskX\Api\Operator |
||
7 | { |
||
8 | /** |
||
9 | * @param array $properties |
||
10 | * @return Struct\Info |
||
11 | */ |
||
12 | public function create($properties) |
||
23 | |||
24 | /** |
||
25 | * @param string $field |
||
26 | * @param integer|string $value |
||
27 | * @return Struct\Info |
||
28 | */ |
||
29 | public function get($field, $value) |
||
34 | |||
35 | /** |
||
36 | * @param string $field |
||
37 | * @param integer|string $value |
||
38 | * @return Struct\Info[] |
||
39 | */ |
||
40 | View Code Duplication | public function getAll($field, $value) |
|
59 | |||
60 | /** |
||
61 | * @param string $field |
||
62 | * @param integer|string $value |
||
63 | * @return bool |
||
64 | */ |
||
65 | public function delete($field, $value) |
||
69 | } |
||
70 |