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 |
||
| 9 | class CFormContact extends \Mos\HTMLForm\CForm { |
||
|
|
|||
| 10 | |||
| 11 | |||
| 12 | /** Create all form elements and validation rules in the constructor. |
||
| 13 | * |
||
| 14 | */ |
||
| 15 | public function __construct() { |
||
| 16 | parent::__construct(); |
||
| 17 | |||
| 18 | $this->AddElement(new \Mos\HTMLForm\CFormElementText('name')) |
||
| 19 | ->AddElement(new \Mos\HTMLForm\CFormElementText('email')) |
||
| 20 | ->AddElement(new \Mos\HTMLForm\CFormElementText('phone')) |
||
| 21 | ->AddElement(new \Mos\HTMLForm\CFormElementSubmit('submit', array('callback'=>array($this, 'DoSubmit')))); |
||
| 22 | } |
||
| 23 | |||
| 24 | |||
| 25 | /** |
||
| 26 | * Callback for submitted forms |
||
| 27 | */ |
||
| 28 | protected function DoSubmit() { |
||
| 29 | echo "<p><i>DoSubmit(): Form was submitted. Do stuff (save to database) and return true (success) or false (failed processing form)</i></p>"; |
||
| 30 | return true; |
||
| 31 | } |
||
| 32 | |||
| 33 | } |
||
| 34 | |||
| 54 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths