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 |
||
| 3 | class AddXOriginatingIpHeaderPlugin extends \RainLoop\Plugins\AbstractPlugin |
||
| 4 | {
|
||
| 5 | public function Init() |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @param \MailSo\Mime\Message $oMessage |
||
| 12 | */ |
||
| 13 | public function FilterBuildMessage(&$oMessage) |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @return array |
||
| 29 | */ |
||
| 30 | View Code Duplication | public function configMapping() |
|
| 40 | } |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.jsonfile (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.jsonto be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
requireorrequire-devsection?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceofchecks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.