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 |
||
15 | class Sifr extends Object |
||
|
|||
16 | { |
||
17 | protected static $is_disabled = false; |
||
18 | |||
19 | protected static $js_custom_file_location = "mysite/javascript/sifr-config.js"; |
||
20 | |||
21 | View Code Duplication | public static function disable() |
|
30 | |||
31 | public static function set_js_custom_file_location($folderAndFile) |
||
35 | |||
36 | View Code Duplication | public static function load_sifr() |
|
46 | |||
47 | public function is_disabled() |
||
52 | } |
||
53 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.