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 |
||
30 | abstract class AbstractSecondaryAuthenticationProvider extends AbstractAuthenticationProvider |
||
|
|||
31 | implements SecondaryAuthenticationProvider |
||
32 | { |
||
33 | |||
34 | public function continueSecondaryAuthentication( $user, array $reqs ) { |
||
37 | |||
38 | public function postAuthentication( $user, AuthenticationResponse $response ) { |
||
40 | |||
41 | public function providerAllowsPropertyChange( $property ) { |
||
44 | |||
45 | /** |
||
46 | * @inheritdoc |
||
47 | * @note Reimplement this if self::getAuthenticationRequests( AuthManager::ACTION_REMOVE ) |
||
48 | * doesn't return requests that will revoke all access for the user. |
||
49 | */ |
||
50 | View Code Duplication | public function providerRevokeAccessForUser( $username ) { |
|
59 | |||
60 | public function providerAllowsAuthenticationDataChange( |
||
65 | |||
66 | public function providerChangeAuthenticationData( AuthenticationRequest $req ) { |
||
68 | |||
69 | public function testForAccountCreation( $user, $creator, array $reqs ) { |
||
72 | |||
73 | public function continueSecondaryAccountCreation( $user, $creator, array $reqs ) { |
||
76 | |||
77 | public function postAccountCreation( $user, $creator, AuthenticationResponse $response ) { |
||
79 | |||
80 | public function testUserForCreation( $user, $autocreate, array $options = [] ) { |
||
81 | return \StatusValue::newGood(); |
||
82 | } |
||
83 | |||
84 | public function autoCreatedAccount( $user, $source ) { |
||
86 | } |
||
87 |