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 SiteAlias extends \PleskX\Api\Operator |
||
9 | { |
||
10 | /** |
||
11 | * @param array $properties |
||
12 | * @param array $preferences |
||
13 | * @return Struct\Info |
||
14 | */ |
||
15 | public function create(array $properties, array $preferences = []) |
||
34 | |||
35 | /** |
||
36 | * @param string $field |
||
37 | * @param integer|string $value |
||
38 | * @return Struct\Info |
||
39 | */ |
||
40 | public function get($field, $value) |
||
45 | |||
46 | /** |
||
47 | * @param string $field |
||
48 | * @param integer|string $value |
||
49 | * @return Struct\Info[] |
||
50 | */ |
||
51 | View Code Duplication | public function getAll($field = null, $value = null) |
|
69 | } |
||
70 |