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 |
||
4 | class Widget { |
||
5 | |||
6 | public static $js; |
||
7 | public static $css; |
||
8 | public static $title; |
||
9 | public static $description; |
||
10 | public static $keywords; |
||
11 | private static $config; |
||
12 | private static $app; |
||
13 | private static $view; |
||
14 | private static $property; |
||
15 | private static $path; |
||
|
|||
16 | private static $uri; |
||
17 | |||
18 | View Code Duplication | public function __construct(){ |
|
38 | |||
39 | public function __get($name){ |
||
43 | |||
44 | public function __call($_name,$value){ |
||
49 | |||
50 | } |
||
51 | ?> |
||
52 |
This check marks private properties in classes that are never used. Those properties can be removed.