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 |
||
10 | View Code Duplication | class Oci8SingletonConnection extends Oci8Connection |
|
11 | { |
||
12 | /** |
||
13 | * Connect to an Oracle database |
||
14 | * |
||
15 | * New instances of this class will use the same connection during the script life cycle. |
||
16 | * |
||
17 | * @param $username |
||
18 | * @param string $password |
||
19 | * @param string $connectionString |
||
20 | * @param string $characterSet |
||
21 | * @param int $sessionMode |
||
22 | * @return resource |
||
23 | * @see http://php.net/manual/en/function.oci-connect.php |
||
24 | */ |
||
25 | 2 | protected function connect( |
|
37 | } |
||
38 |