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 | * |
||
| 14 | * @return Struct\Info |
||
| 15 | */ |
||
| 16 | public function create(array $properties, array $preferences = []) |
||
| 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\GeneralInfo |
||
| 53 | */ |
||
| 54 | public function get($field, $value) |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @param string $field |
||
| 63 | * @param int|string $value |
||
| 64 | * |
||
| 65 | * @return Struct\GeneralInfo[] |
||
| 66 | */ |
||
| 67 | View Code Duplication | public function getAll($field = null, $value = null) |
|
| 86 | } |
||
| 87 |