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 |
||
8 | class Subdomain extends \PleskX\Api\Operator |
||
9 | { |
||
10 | /** |
||
11 | * @param array $properties |
||
12 | * |
||
13 | * @return Struct\Info |
||
14 | */ |
||
15 | public function create($properties) |
||
36 | |||
37 | /** |
||
38 | * @param string $field |
||
39 | * @param int|string $value |
||
40 | * |
||
41 | * @return bool |
||
42 | */ |
||
43 | public function delete($field, $value) |
||
47 | |||
48 | /** |
||
49 | * @param string $field |
||
50 | * @param int|string $value |
||
51 | * |
||
52 | * @return Struct\Info |
||
53 | */ |
||
54 | public function get($field, $value) |
||
60 | |||
61 | /** |
||
62 | * @param string $field |
||
63 | * @param int|string $value |
||
64 | * |
||
65 | * @return Struct\Info[] |
||
66 | */ |
||
67 | View Code Duplication | public function getAll($field = null, $value = null) |
|
91 | } |
||
92 |