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  | 
            ||
| 7 | class AuthConfigHelper  | 
            ||
| 8 | { | 
            ||
| 9 | /**  | 
            ||
| 10 | * Get the user provider on configs.  | 
            ||
| 11 | *  | 
            ||
| 12 | * @param Authenticatable $user  | 
            ||
| 13 | * @return string|null  | 
            ||
| 14 | */  | 
            ||
| 15 | public static function getUserProvider(Authenticatable $user)  | 
            ||
| 23 | |||
| 24 | /**  | 
            ||
| 25 | * Get the guard of specific provider to `passport` driver.  | 
            ||
| 26 | *  | 
            ||
| 27 | * @param string $provider  | 
            ||
| 28 | * @return string  | 
            ||
| 29 | */  | 
            ||
| 30 | View Code Duplication | public static function getProviderGuard($provider)  | 
            |
| 38 | |||
| 39 | /**  | 
            ||
| 40 | * Get the user guard on provider with `passport` driver.  | 
            ||
| 41 | *  | 
            ||
| 42 | * @param Authenticatable $user  | 
            ||
| 43 | * @return string|null  | 
            ||
| 44 | */  | 
            ||
| 45 | public static function getUserGuard(Authenticatable $user)  | 
            ||
| 51 | }  | 
            ||
| 52 | 
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.