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 |
||
| 2 | class PublicController extends LoginController |
||
| 3 | { |
||
| 4 | public $layout='//layouts/columnGuest'; |
||
|
|
|||
| 5 | |||
| 6 | public function actionIndex() |
||
| 31 | |||
| 32 | public function actionTerms() |
||
| 36 | |||
| 37 | public function actionPrivacy() |
||
| 41 | |||
| 42 | View Code Duplication | protected function beforeAction($action) |
|
| 50 | } |
||
| 51 |
This check looks for improperly formatted assignments.
Every assignment must have exactly one space before and one space after the equals operator.
To illustrate:
will have no issues, while
will report issues in lines 1 and 2.