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 |
||
| 7 | class DataslangApi { |
||
| 8 | |||
| 9 | const BASE_URI = 'http://api.dataslang'; |
||
| 10 | |||
| 11 | private $client = null; |
||
|
|
|||
| 12 | private $settings = array(); |
||
| 13 | private $timeout = 7; |
||
| 14 | |||
| 15 | View Code Duplication | public function validate($xml, $xsd){ |
|
| 36 | |||
| 37 | View Code Duplication | public function transformToXml($xml){ |
|
| 57 | |||
| 58 | View Code Duplication | public function transformToHtml($xml, $xsl, $dest_path){ |
|
| 80 | |||
| 81 | public function setTimeout($timeout){ |
||
| 84 | |||
| 85 | public function getTimeout(){ |
||
| 88 | |||
| 89 | public function getBaseUri(){ |
||
| 92 | |||
| 93 | private function getClient(){ |
||
| 100 | |||
| 101 | } |
||
| 102 |
This check marks private properties in classes that are never used. Those properties can be removed.