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 PaginatedKnpLabsRepoFacadeTest extends \PHPUnit_Framework_TestCase |
||
| 13 | { |
||
| 14 | private $facade; |
||
| 15 | |||
| 16 | public function setUp() |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @group GithubIntegration |
||
| 28 | * @group Live |
||
| 29 | */ |
||
| 30 | public function testFetchRepoDetails() |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @group GithubIntegration |
||
| 39 | * @group Live |
||
| 40 | */ |
||
| 41 | public function testFetchBranch() |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @group GithubIntegration |
||
| 50 | * @group Live |
||
| 51 | */ |
||
| 52 | public function testFetchAllBranches() |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @group GithubIntegration |
||
| 59 | * @group Live |
||
| 60 | */ |
||
| 61 | public function testFetchAllBranchNames() |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @group GithubIntegration |
||
| 68 | * @group Live |
||
| 69 | */ |
||
| 70 | public function testFetchAllTags() |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @group GithubIntegration |
||
| 77 | * @group Live |
||
| 78 | */ |
||
| 79 | public function testFetchAllTagNames() |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @group GithubIntegration |
||
| 86 | * @group Live |
||
| 87 | */ |
||
| 88 | public function testFetchCommit() |
||
| 94 | |||
| 95 | /** |
||
| 96 | * @group GithubIntegration |
||
| 97 | * @group Live |
||
| 98 | */ |
||
| 99 | public function testFetchCommitStatuses() |
||
| 103 | |||
| 104 | /** |
||
| 105 | * @group GithubIntegration |
||
| 106 | * @group Live |
||
| 107 | */ |
||
| 108 | public function testFetchCommitStatus() |
||
| 116 | |||
| 117 | /** |
||
| 118 | * @group GithubIntegration |
||
| 119 | * @group Live |
||
| 120 | */ |
||
| 121 | public function testFetchAllPullRequests() |
||
| 125 | |||
| 126 | /** |
||
| 127 | * @group GithubIntegration |
||
| 128 | * @group Live |
||
| 129 | */ |
||
| 130 | public function testFetchAllMilestones() |
||
| 134 | |||
| 135 | /** |
||
| 136 | * @group GithubIntegration |
||
| 137 | * @group Live |
||
| 138 | */ |
||
| 139 | public function testFetchAllIssues() |
||
| 143 | |||
| 144 | /** |
||
| 145 | * @group GithubIntegration |
||
| 146 | * @group Live |
||
| 147 | */ |
||
| 148 | public function testFetchAllIssuesAndPullRequests() |
||
| 152 | |||
| 153 | /** |
||
| 154 | * @return \Github\Client |
||
| 155 | */ |
||
| 156 | private function getTokenAuthenticatedApiClient() |
||
| 162 | |||
| 163 | /** |
||
| 164 | * @return \DevBoardLib\GithubCore\Repo\GithubRepo |
||
| 165 | */ |
||
| 166 | View Code Duplication | private function provideTestRepo() |
|
| 175 | |||
| 176 | /** |
||
| 177 | * @return \DevBoardLib\GithubApiFacade\Auth\GithubAccessToken |
||
| 178 | */ |
||
| 179 | private function provideTestUser() |
||
| 186 | } |
||
| 187 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.