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 defined('BASEPATH') OR exit('No direct script access allowed'); |
||
3 | class Logout extends User_Controller { |
||
4 | //we shouldn't care if the user is logged in or not, since ion_auth will take care of things |
||
5 | |||
6 | 1 | View Code Duplication | public function __construct() { |
17 | |||
18 | 1 | public function index() : void { |
|
32 | } |
||
33 |