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 declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
||
| 3 | class Tracker_Category_Model extends Tracker_Base_Model { |
||
| 4 | 112 | public function __construct() { |
|
| 7 | |||
| 8 | View Code Duplication | public function setByID(int $userID, int $chapterID, string $category) : bool { |
|
| 16 | |||
| 17 | public function setByIDList(array $idList, string $category) : array { |
||
| 40 | |||
| 41 | public function getUsed(int $userID) : array { |
||
| 51 | } |
||
| 52 |