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 |
||
| 20 | class ClientRemote extends BaseClientRemote |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * @inheritdoc |
||
| 24 | */ |
||
| 25 | 2 | public function getTables(array $params = []) |
|
| 29 | |||
| 30 | /** |
||
| 31 | * @inheritdoc |
||
| 32 | */ |
||
| 33 | 4 | public function getTable($tableName) |
|
| 39 | |||
| 40 | /** |
||
| 41 | * @inheritdoc |
||
| 42 | */ |
||
| 43 | 2 | public function getColumns($tableName, array $params = []) |
|
| 49 | |||
| 50 | /** |
||
| 51 | * @inheritdoc |
||
| 52 | */ |
||
| 53 | 2 | public function getColumn($tableName, $columnName) |
|
| 59 | |||
| 60 | /** |
||
| 61 | * @inheritdoc |
||
| 62 | */ |
||
| 63 | 2 | public function getEntries($tableName, array $options = []) |
|
| 69 | |||
| 70 | /** |
||
| 71 | * @inheritdoc |
||
| 72 | */ |
||
| 73 | 2 | public function getEntry($tableName, $id, array $options = []) |
|
| 79 | |||
| 80 | /** |
||
| 81 | * @inheritdoc |
||
| 82 | */ |
||
| 83 | 2 | public function getUsers(array $params = []) |
|
| 87 | |||
| 88 | /** |
||
| 89 | * @inheritdoc |
||
| 90 | */ |
||
| 91 | 2 | public function getUser($id, array $params = []) |
|
| 95 | |||
| 96 | /** |
||
| 97 | * @inheritdoc |
||
| 98 | */ |
||
| 99 | 2 | public function getGroups() |
|
| 103 | |||
| 104 | /** |
||
| 105 | * @inheritdoc |
||
| 106 | */ |
||
| 107 | 2 | public function getGroup($groupID) |
|
| 113 | |||
| 114 | /** |
||
| 115 | * @inheritdoc |
||
| 116 | */ |
||
| 117 | 2 | public function getGroupPrivileges($groupID) |
|
| 123 | |||
| 124 | /** |
||
| 125 | * @inheritdoc |
||
| 126 | */ |
||
| 127 | 2 | public function getFiles() |
|
| 131 | |||
| 132 | /** |
||
| 133 | * @inheritdoc |
||
| 134 | */ |
||
| 135 | 2 | public function getFile($fileID) |
|
| 141 | |||
| 142 | /** |
||
| 143 | * @inheritdoc |
||
| 144 | */ |
||
| 145 | 2 | public function getSettings() |
|
| 149 | |||
| 150 | /** |
||
| 151 | * @inheritdoc |
||
| 152 | */ |
||
| 153 | 2 | public function getSettingsByCollection($collectionName) |
|
| 159 | |||
| 160 | /** |
||
| 161 | * @inheritdoc |
||
| 162 | */ |
||
| 163 | public function getMessages($userId) |
||
| 169 | |||
| 170 | /** |
||
| 171 | * @inheritdoc |
||
| 172 | */ |
||
| 173 | View Code Duplication | public function createEntry($tableName, array $data) |
|
| 180 | |||
| 181 | /** |
||
| 182 | * @inheritdoc |
||
| 183 | */ |
||
| 184 | View Code Duplication | public function updateEntry($tableName, $id, array $data) |
|
| 191 | |||
| 192 | /** |
||
| 193 | * @inheritdoc |
||
| 194 | */ |
||
| 195 | public function deleteEntry($tableName, $id) |
||
| 201 | |||
| 202 | /** |
||
| 203 | * @inheritdoc |
||
| 204 | */ |
||
| 205 | public function createUser(array $data) |
||
| 209 | |||
| 210 | /** |
||
| 211 | * @inheritdoc |
||
| 212 | */ |
||
| 213 | public function updateUser($id, array $data) |
||
| 217 | |||
| 218 | /** |
||
| 219 | * @inheritdoc |
||
| 220 | */ |
||
| 221 | public function deleteUser($ids) |
||
| 225 | |||
| 226 | /** |
||
| 227 | * @inheritdoc |
||
| 228 | */ |
||
| 229 | public function createFile(File $file) |
||
| 235 | |||
| 236 | /** |
||
| 237 | * @inheritdoc |
||
| 238 | */ |
||
| 239 | public function updateFile($id, array $data) |
||
| 243 | |||
| 244 | /** |
||
| 245 | * @inheritdoc |
||
| 246 | */ |
||
| 247 | public function deleteFile($id) |
||
| 251 | |||
| 252 | public function createPreferences($data) |
||
| 264 | |||
| 265 | /** |
||
| 266 | * @inheritdoc |
||
| 267 | */ |
||
| 268 | public function createBookmark($data) |
||
| 287 | |||
| 288 | /** |
||
| 289 | * @inheritdoc |
||
| 290 | */ |
||
| 291 | public function createColumn($data) |
||
| 295 | } |
||
| 296 |