We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
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 |
||
16 | class AccessTest extends TestCase |
||
17 | { |
||
18 | const USER_RYAN = 'ryan'; |
||
19 | const USER_ADMIN = 'admin'; |
||
20 | const ANONYMOUS_USER = null; |
||
21 | |||
22 | private $userNameQuery = 'query MyQuery { user { name } }'; |
||
23 | |||
24 | private $userRolesQuery = 'query MyQuery { user { roles } }'; |
||
25 | |||
26 | private $userIsEnabledQuery = 'query MyQuery { user { isEnabled } }'; |
||
27 | |||
28 | private $userFriendsQuery = <<<EOF |
||
29 | query MyQuery { |
||
30 | user { |
||
31 | friends(first: 2) { |
||
32 | edges { |
||
33 | node { |
||
34 | name |
||
35 | } |
||
36 | } |
||
37 | } |
||
38 | } |
||
39 | } |
||
40 | EOF; |
||
41 | |||
42 | View Code Duplication | public function testNotAuthenticatedUserAccessToUserName() |
|
60 | |||
61 | public function testFullyAuthenticatedUserAccessToUserName() |
||
73 | |||
74 | public function testNotAuthenticatedUserAccessToUserRoles() |
||
78 | |||
79 | public function testAuthenticatedUserAccessToUserRolesWithoutEnoughRights() |
||
83 | |||
84 | public function testUserWithCorrectRightsAccessToUserRoles() |
||
96 | |||
97 | public function testUserAccessToUserFriends() |
||
114 | |||
115 | View Code Duplication | public function testUserAccessToUserIsEnabledWithExpressionLanguageEvaluationFailed() |
|
133 | |||
134 | private function expectedFailedUserRoles() |
||
144 | |||
145 | View Code Duplication | private static function assertResponse($query, array $expected, $username) |
|
156 | |||
157 | private static function createClientAuthenticated($username) |
||
170 | } |
||
171 |
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.