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 | View Code Duplication | class Events extends AbstractIssues | |
|  | |||
| 11 | { | ||
| 12 | |||
| 13 | /** | ||
| 14 | * List events for an issue | ||
| 15 | * | ||
| 16 | * @link https://developer.github.com/v3/issues/events/#list-events-for-an-issue | ||
| 17 | * | ||
| 18 | * @param int $issueNumber | ||
| 19 | * | ||
| 20 | * @return array | ||
| 21 | */ | ||
| 22 | public function listIssueEvents(int $issueNumber): array | ||
| 27 | |||
| 28 | /** | ||
| 29 | * List events for a repository | ||
| 30 | * | ||
| 31 | * @link https://developer.github.com/v3/issues/events/#list-events-for-a-repository | ||
| 32 | * @return array | ||
| 33 | */ | ||
| 34 | public function listRepositoryEvents(): array | ||
| 39 | |||
| 40 | /** | ||
| 41 | * Get a single event | ||
| 42 | * | ||
| 43 | * @link https://developer.github.com/v3/issues/events/#get-a-single-event | ||
| 44 | * | ||
| 45 | * @param int $id | ||
| 46 | * | ||
| 47 | * @return array | ||
| 48 | */ | ||
| 49 | public function getEvent(int $id): array | ||
| 54 | } | 
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.