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 Connection extends \hiqdev\hiart\Connection |
||
17 | { |
||
18 | /** |
||
19 | * {@inheritdoc} |
||
20 | */ |
||
21 | public function init() |
||
25 | |||
26 | /** |
||
27 | * @param mixed $response The response |
||
28 | * @return null|string |
||
29 | * - string: the error text |
||
30 | * - null: the response is not an error |
||
31 | */ |
||
32 | public function checkError($response) |
||
49 | |||
50 | public function getAuth() |
||
76 | } |
||
77 |
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.