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 |
||
| 33 | class XoopsMySQLDatabaseProxy extends XoopsMySQLDatabase |
||
|
|
|||
| 34 | { |
||
| 35 | /** |
||
| 36 | * perform a query on the database |
||
| 37 | * |
||
| 38 | * this method allows only SELECT queries for safety. |
||
| 39 | * |
||
| 40 | * @param string $sql a valid MySQL query |
||
| 41 | * @param int $limit number of records to return |
||
| 42 | * @param int $start offset of first record to return |
||
| 43 | * |
||
| 44 | * @return resource query result or FALSE if unsuccessful |
||
| 45 | * @deprecated since version 2.6.0 - alpha 3. Switch to doctrine connector. |
||
| 46 | */ |
||
| 47 | public function query($sql, $limit = 0, $start = 0) |
||
| 56 | } |
||
| 57 | } |
||
| 58 |