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 SecretKey extends \PleskX\Api\Operator |
||
9 | { |
||
10 | protected $_wrapperTag = 'secret_key'; |
||
11 | |||
12 | /** |
||
13 | * @param string $ipAddress |
||
14 | * @param string $description |
||
15 | * |
||
16 | * @return string |
||
17 | */ |
||
18 | public function create($ipAddress = '', $description = '') |
||
35 | |||
36 | /** |
||
37 | * @param string $keyId |
||
38 | * |
||
39 | * @return bool |
||
40 | */ |
||
41 | public function delete($keyId) |
||
45 | |||
46 | /** |
||
47 | * @param string $keyId |
||
48 | * |
||
49 | * @return Struct\Info |
||
50 | */ |
||
51 | public function get($keyId) |
||
57 | |||
58 | /** |
||
59 | * @return Struct\Info[] |
||
60 | */ |
||
61 | public function getAll() |
||
65 | |||
66 | /** |
||
67 | * @param string|null $keyId |
||
68 | * |
||
69 | * @return Struct\Info[] |
||
70 | */ |
||
71 | View Code Duplication | public function _get($keyId = null) |
|
90 | } |
||
91 |