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 |
||
| 24 | class MysqlConfig extends AbstractConfig |
||
| 25 | { |
||
| 26 | /** |
||
| 27 | * @var Connection |
||
| 28 | */ |
||
| 29 | protected $connection; |
||
| 30 | protected $tableName; |
||
| 31 | protected $tableExists; |
||
| 32 | |||
| 33 | public function __construct(Connection $connection, $tableName = '_config') |
||
| 38 | |||
| 39 | /** |
||
| 40 | * {@inheritDoc} |
||
| 41 | */ |
||
| 42 | public function doGetAll() |
||
| 53 | |||
| 54 | /** |
||
| 55 | * {@inheritDoc} |
||
| 56 | */ |
||
| 57 | protected function doSetAll(array $values) |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Proxy method to connection object. If an error occurred because of unfound table, tries to create table and rerun request. |
||
| 69 | * |
||
| 70 | * @param string $query SQL query |
||
| 71 | * @param array $parameters query parameters |
||
| 72 | */ |
||
| 73 | View Code Duplication | protected function runSQL($query, array $parameters = array()) |
|
| 83 | } |
||
| 84 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.