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 SecretKey extends \PleskX\Api\Operator |
||
| 8 | { |
||
| 9 | |||
| 10 | protected $_wrapperTag = 'secret_key'; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @param string $ipAddress |
||
| 14 | * @return string |
||
| 15 | */ |
||
| 16 | public function create($ipAddress) |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param string $keyId |
||
| 26 | * @return bool |
||
| 27 | */ |
||
| 28 | public function delete($keyId) |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param string $keyId |
||
| 35 | * @return Struct\Info |
||
| 36 | */ |
||
| 37 | public function get($keyId) |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return Struct\Info[] |
||
| 45 | */ |
||
| 46 | public function getAll() |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @param string $field |
||
| 53 | * @param integer|string $value |
||
| 54 | * @return Struct\Info[] |
||
| 55 | */ |
||
| 56 | View Code Duplication | public function _get($keyId = null) |
|
| 75 | |||
| 76 | } |
||
| 77 |