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 |
||
7 | class Subdomain extends \PleskX\Api\Operator |
||
8 | { |
||
9 | /** |
||
10 | * @param array $properties |
||
11 | * @return Struct\Info |
||
12 | */ |
||
13 | public function create($properties) |
||
25 | |||
26 | /** |
||
27 | * @param string $field |
||
28 | * @param integer|string $value |
||
29 | * @return bool |
||
30 | */ |
||
31 | public function delete($field, $value) |
||
35 | |||
36 | /** |
||
37 | * @param string $field |
||
38 | * @param integer|string $value |
||
39 | * @return Struct\Info |
||
40 | */ |
||
41 | public function get($field, $value) |
||
46 | |||
47 | /** |
||
48 | * @param string $field |
||
49 | * @param integer|string $value |
||
50 | * @return Struct\Info[] |
||
51 | */ |
||
52 | View Code Duplication | public function getAll($field = null, $value = null) |
|
73 | } |
||
74 |