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  | 
            ||
| 30 | class LegacyInspector extends Client  | 
            ||
| 31 | { | 
            ||
| 32 | use InspectorTrait;  | 
            ||
| 33 | |||
| 34 | /**  | 
            ||
| 35 | * getClientType  | 
            ||
| 36 | *  | 
            ||
| 37 | * @see ClientInterface  | 
            ||
| 38 | */  | 
            ||
| 39 | public function getClientType()  | 
            ||
| 43 | |||
| 44 | /**  | 
            ||
| 45 | * getClientIdentifier  | 
            ||
| 46 | *  | 
            ||
| 47 | * @see ClientInterface  | 
            ||
| 48 | */  | 
            ||
| 49 | public function getClientIdentifier()  | 
            ||
| 53 | |||
| 54 | /**  | 
            ||
| 55 | * getSchemas  | 
            ||
| 56 | *  | 
            ||
| 57 | * Return a list of available schemas in the current database.  | 
            ||
| 58 | *  | 
            ||
| 59 | * @return \PommProject\Foundation\ConvertedResultIterator  | 
            ||
| 60 | * @deprecated  | 
            ||
| 61 | */  | 
            ||
| 62 | public function getSchemas()  | 
            ||
| 85 | |||
| 86 | /**  | 
            ||
| 87 | * getTableOid  | 
            ||
| 88 | *  | 
            ||
| 89 | * Return the table oid from PostgreSQL catalog. If no table is found, null  | 
            ||
| 90 | * is returned.  | 
            ||
| 91 | *  | 
            ||
| 92 | * @param string $schema  | 
            ||
| 93 | * @param string $table  | 
            ||
| 94 | * @return int|null  | 
            ||
| 95 | * @deprecated  | 
            ||
| 96 | */  | 
            ||
| 97 | View Code Duplication | public function getTableOid($schema, $table)  | 
            |
| 117 | |||
| 118 | /**  | 
            ||
| 119 | * getTableFieldInformation  | 
            ||
| 120 | *  | 
            ||
| 121 | * Get table's field information. If no fields are found, null is  | 
            ||
| 122 | * returned.  | 
            ||
| 123 | *  | 
            ||
| 124 | * @param int $oid  | 
            ||
| 125 | * @return \PommProject\Foundation\ConvertedResultIterator|null  | 
            ||
| 126 | * @deprecated  | 
            ||
| 127 | */  | 
            ||
| 128 | public function getTableFieldInformation($oid)  | 
            ||
| 162 | |||
| 163 | /**  | 
            ||
| 164 | * getSchemaOid  | 
            ||
| 165 | *  | 
            ||
| 166 | * Return the given schema oid, null if the schema is not found.  | 
            ||
| 167 | *  | 
            ||
| 168 | * @param string $schema  | 
            ||
| 169 | * @param Where $where optional where clause.  | 
            ||
| 170 | * @return int|null  | 
            ||
| 171 | * @deprecated  | 
            ||
| 172 | */  | 
            ||
| 173 | View Code Duplication | public function getSchemaOid($schema, Where $where = null)  | 
            |
| 192 | |||
| 193 | /**  | 
            ||
| 194 | * getPrimaryKey  | 
            ||
| 195 | *  | 
            ||
| 196 | * Get relation's primary key if any.  | 
            ||
| 197 | *  | 
            ||
| 198 | * @param int $table_oid  | 
            ||
| 199 | * @return array|null  | 
            ||
| 200 | * @deprecated  | 
            ||
| 201 | */  | 
            ||
| 202 | public function getPrimaryKey($table_oid)  | 
            ||
| 231 | |||
| 232 | /**  | 
            ||
| 233 | * getSchemaRelations  | 
            ||
| 234 | *  | 
            ||
| 235 | * Return information on relations in a given schema. An additional Where  | 
            ||
| 236 | * condition can be passed to filter against other criteria.  | 
            ||
| 237 | *  | 
            ||
| 238 | * @param int $schema_oid  | 
            ||
| 239 | * @param Where $where  | 
            ||
| 240 | * @return \PommProject\Foundation\ConvertedResultIterator  | 
            ||
| 241 | * @deprecated  | 
            ||
| 242 | */  | 
            ||
| 243 | public function getSchemaRelations($schema_oid, Where $where = null)  | 
            ||
| 272 | |||
| 273 | /**  | 
            ||
| 274 | * getTableComment  | 
            ||
| 275 | *  | 
            ||
| 276 | * Return the comment on a table if set. Null otherwise.  | 
            ||
| 277 | *  | 
            ||
| 278 | * @param int $table_oid  | 
            ||
| 279 | * @return string|null  | 
            ||
| 280 | * @deprecated  | 
            ||
| 281 | */  | 
            ||
| 282 | View Code Duplication | public function getTableComment($table_oid)  | 
            |
| 293 | |||
| 294 | /**  | 
            ||
| 295 | * getTypeInformation  | 
            ||
| 296 | *  | 
            ||
| 297 | * Return the Oid of the given type name.  | 
            ||
| 298 | * It Additionally returns the type category.  | 
            ||
| 299 | *  | 
            ||
| 300 | * @param string $type_name  | 
            ||
| 301 | * @param string $type_schema  | 
            ||
| 302 | * @return array|null  | 
            ||
| 303 | * @deprecated  | 
            ||
| 304 | */  | 
            ||
| 305 | public function getTypeInformation($type_name, $type_schema = null)  | 
            ||
| 329 | |||
| 330 | /**  | 
            ||
| 331 | * getTypeCategory  | 
            ||
| 332 | *  | 
            ||
| 333 | * Get type category.  | 
            ||
| 334 | *  | 
            ||
| 335 | * @param int $oid  | 
            ||
| 336 | * @return array|null  | 
            ||
| 337 | * @deprecated  | 
            ||
| 338 | */  | 
            ||
| 339 | View Code Duplication | public function getTypeCategory($oid)  | 
            |
| 358 | |||
| 359 | /**  | 
            ||
| 360 | * getTypeEnumValues  | 
            ||
| 361 | *  | 
            ||
| 362 | * Return all possible values from an enumerated type in its natural order.  | 
            ||
| 363 | *  | 
            ||
| 364 | * @param int $oid  | 
            ||
| 365 | * @return array|null  | 
            ||
| 366 | * @deprecated  | 
            ||
| 367 | */  | 
            ||
| 368 | public function getTypeEnumValues($oid)  | 
            ||
| 390 | |||
| 391 | /**  | 
            ||
| 392 | * getCompositeInformation  | 
            ||
| 393 | *  | 
            ||
| 394 | * Return the structure of a composite row.  | 
            ||
| 395 | *  | 
            ||
| 396 | * @param int $oid  | 
            ||
| 397 | * @return \PommProject\Foundation\ConvertedResultIterator  | 
            ||
| 398 | * @deprecated  | 
            ||
| 399 | */  | 
            ||
| 400 | public function getCompositeInformation($oid)  | 
            ||
| 417 | |||
| 418 | /**  | 
            ||
| 419 | * getVersion  | 
            ||
| 420 | *  | 
            ||
| 421 | * Return server version.  | 
            ||
| 422 | *  | 
            ||
| 423 | * @throws FoundationException if invalid string.  | 
            ||
| 424 | * @return string  | 
            ||
| 425 | * @deprecated  | 
            ||
| 426 | */  | 
            ||
| 427 | public function getVersion()  | 
            ||
| 436 | }  | 
            ||
| 437 |