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 | ||
| 12 | class Statuses extends AbstractRepositories | ||
| 13 | { | ||
| 14 | |||
| 15 | /** | ||
| 16 | * Create a Status | ||
| 17 | * | ||
| 18 | * @link https://developer.github.com/v3/repos/statuses/#create-a-status | ||
| 19 | * | ||
| 20 | * @param string $sha | ||
| 21 | * @param string $state | ||
| 22 | * @param string $targetUrl | ||
| 23 | * @param string $description | ||
| 24 | * @param string $context | ||
| 25 | * | ||
| 26 | * @return array | ||
| 27 | */ | ||
| 28 | View Code Duplication | public function createStatus(string $sha, string $state, string $targetUrl = null, string $description = null, | |
| 39 | |||
| 40 | /** | ||
| 41 | * List Statuses for a specific Ref | ||
| 42 | * | ||
| 43 | * @link https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref | ||
| 44 | * | ||
| 45 | * @param string $ref | ||
| 46 | * | ||
| 47 | * @return array | ||
| 48 | */ | ||
| 49 | public function listStatuses(string $ref): array | ||
| 54 | |||
| 55 | /** | ||
| 56 | * Get the combined Status for a specific Ref | ||
| 57 | * | ||
| 58 | * @link https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref | ||
| 59 | * | ||
| 60 | * @param string $ref | ||
| 61 | * | ||
| 62 | * @return array | ||
| 63 | */ | ||
| 64 | public function getCombinedStatus(string $ref): array | ||
| 69 | } | 
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.