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.com'; |
||
10 | |||
11 | private $client = null; |
||
12 | private $settings = array(); |
||
|
|||
13 | private $timeout = 7; |
||
14 | |||
15 | View Code Duplication | public function validate($xml, $xsd){ |
|
37 | |||
38 | View Code Duplication | public function transformToXml($xml, $xsl, $dest_path){ |
|
61 | |||
62 | View Code Duplication | public function transformToHtml($xml, $xsl, $dest_path){ |
|
85 | |||
86 | public function setTimeout($timeout){ |
||
89 | |||
90 | public function getTimeout(){ |
||
93 | |||
94 | public function getBaseUri(){ |
||
97 | |||
98 | private function getClient(){ |
||
109 | } |
||
110 |
This check marks private properties in classes that are never used. Those properties can be removed.