|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Port\Middleware\Middlewares; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class Kernel |
|
7
|
|
|
* |
|
8
|
|
|
* @author Mahmoud Zalt <[email protected]> |
|
9
|
|
|
*/ |
|
10
|
|
|
class Kernel |
|
11
|
|
|
{ |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* The application's global HTTP middleware stack. |
|
15
|
|
|
* |
|
16
|
|
|
* @return array |
|
17
|
|
|
*/ |
|
18
|
|
|
public function applicationMiddlewares() |
|
19
|
|
|
{ |
|
20
|
|
|
return [ |
|
21
|
|
|
// Laravel default middleware's |
|
22
|
|
|
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, |
|
23
|
|
|
\App\Port\Middleware\Middlewares\Http\EncryptCookies::class, |
|
24
|
|
|
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, |
|
25
|
|
|
|
|
26
|
|
|
// removing some of the Laravel's default middleware's |
|
27
|
|
|
// \Illuminate\Session\Middleware\StartSession::class, |
|
28
|
|
|
// \Illuminate\View\Middleware\ShareErrorsFromSession::class, |
|
29
|
|
|
// \App\Port\Middleware\Middlewares\Http\VerifyCsrfToken::class, |
|
30
|
|
|
|
|
31
|
|
|
// CORS Package middleware |
|
32
|
|
|
\Barryvdh\Cors\HandleCors::class, |
|
33
|
|
|
// Hello API Localization middleware |
|
34
|
|
|
\App\Port\Middleware\Middlewares\Http\Localization::class, |
|
35
|
|
|
]; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* The application's route middleware. |
|
40
|
|
|
* |
|
41
|
|
|
* @return array |
|
42
|
|
|
*/ |
|
43
|
|
|
public function routeMiddlewares() |
|
44
|
|
|
{ |
|
45
|
|
|
return [ |
|
46
|
|
|
// removing the Laravel's default route middleware's |
|
47
|
|
|
// 'auth' => \App\Port\Middleware\Middlewares\Http\Authenticate::class, |
|
|
|
|
|
|
48
|
|
|
// 'auth.basic' => \App\Port\Middleware\Middlewares\Http\AuthenticateWithBasicAuth::class, |
|
|
|
|
|
|
49
|
|
|
// 'guest' => \App\Port\Middleware\Middlewares\Http\RedirectIfAuthenticated::class, |
|
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
// JWT Package middleware's |
|
52
|
|
|
'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class, |
|
53
|
|
|
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class, |
|
54
|
|
|
|
|
55
|
|
|
// Entrust Package middleware's |
|
56
|
|
|
'role' => \Zizaco\Entrust\Middleware\EntrustRole::class, |
|
57
|
|
|
'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class, |
|
58
|
|
|
'ability' => \Zizaco\Entrust\Middleware\EntrustAbility::class, |
|
59
|
|
|
|
|
60
|
|
|
// Hello API Visitor User Authentication middleware |
|
61
|
|
|
'visitor.auth' => \App\Containers\APIAuthentication\Middlewares\VisitorsAuthentication::class, |
|
62
|
|
|
|
|
63
|
|
|
// ... |
|
64
|
|
|
]; |
|
65
|
|
|
|
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
} |
|
69
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.