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 |
||
16 | class Widget implements iWidget |
||
17 | { |
||
18 | use DynamicGlobal; |
||
19 | |||
20 | /** @var string|null */ |
||
21 | public static $class; |
||
22 | |||
23 | public static function widget(array $params = null) |
||
53 | |||
54 | /** |
||
55 | * Get widget configs from admin part as array $cfg=>$value |
||
56 | * @return array|null|string |
||
57 | */ |
||
58 | public function getConfigs() |
||
63 | |||
64 | public function display() {} |
||
66 | |||
67 | } |