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 |
||
10 | class ActivateController extends Controller { |
||
11 | |||
12 | public function activate() { |
||
22 | |||
23 | View Code Duplication | public function publish() { |
|
34 | |||
35 | View Code Duplication | public function migrate(){ |
|
46 | |||
47 | public function seed(){ |
||
56 | |||
57 | |||
58 | |||
59 | } |
||
60 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.