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) |
||
| 262 | |||
| 263 | /** |
||
| 264 | * @inheritdoc |
||
| 265 | */ |
||
| 266 | public function createBookmark($data) |
||
| 285 | |||
| 286 | /** |
||
| 287 | * @inheritdoc |
||
| 288 | */ |
||
| 289 | public function createColumn($data) |
||
| 297 | |||
| 298 | /** |
||
| 299 | * @inheritdoc |
||
| 300 | */ |
||
| 301 | public function createGroup(array $data) |
||
| 307 | |||
| 308 | /** |
||
| 309 | * @inheritdoc |
||
| 310 | */ |
||
| 311 | public function createMessage(array $data) |
||
| 323 | |||
| 324 | /** |
||
| 325 | * @inheritdoc |
||
| 326 | */ |
||
| 327 | public function sendMessage(array $data) |
||
| 331 | |||
| 332 | /** |
||
| 333 | * @inheritdoc |
||
| 334 | */ |
||
| 335 | public function createPrivileges(array $data) |
||
| 343 | |||
| 344 | public function createTable($name, array $params = []) |
||
| 355 | |||
| 356 | /** |
||
| 357 | * @inheritdoc |
||
| 358 | */ |
||
| 359 | public function createColumnUIOptions(array $data) |
||
| 375 | } |
||
| 376 |