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 | class AdminAuthenticate  | 
            ||
| 31 | { | 
            ||
| 32 | /**  | 
            ||
| 33 | * The Guard implementation.  | 
            ||
| 34 | *  | 
            ||
| 35 | * @var \Illuminate\Contracts\Auth\Guard  | 
            ||
| 36 | */  | 
            ||
| 37 | protected $auth;  | 
            ||
| 38 | |||
| 39 | /**  | 
            ||
| 40 | * Create a new filter instance.  | 
            ||
| 41 | *  | 
            ||
| 42 | * @param \Illuminate\Contracts\Auth\Guard $auth  | 
            ||
| 43 | * @return void  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 44 | */  | 
            ||
| 45 | public function __construct(Guard $auth)  | 
            ||
| 49 | |||
| 50 | /**  | 
            ||
| 51 | * Handle an incoming request.  | 
            ||
| 52 | *  | 
            ||
| 53 | * @param \Illuminate\Http\Request $request  | 
            ||
| 54 | * @param \Closure $next  | 
            ||
| 55 | * @return mixed  | 
            ||
| 56 | */  | 
            ||
| 57 | public function handle($request, Closure $next)  | 
            ||
| 73 | }  | 
            ||
| 74 | 
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.