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 |
||
22 | class LanguageMenu extends \yii\base\Widget |
||
23 | { |
||
24 | use \hiqdev\yii2\language\GetModuleTrait; |
||
25 | |||
26 | public function getLanguages() |
||
30 | |||
31 | public function getLanguage() |
||
35 | |||
36 | public function items() |
||
51 | |||
52 | View Code Duplication | public function getSelectUrl() |
|
64 | } |
||
65 |
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.