Completed
Push — master ( 32afa0...0ba30b )
by Mahmoud
05:59 queued 02:44
created

PortHttpKernel   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 2
cbo 1
dl 0
loc 75
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A registerMiddlewares() 0 6 1
A registerMiddlewareGroups() 0 6 1
1
<?php
2
3
namespace App\Port\Kernel;
4
5
use Illuminate\Foundation\Http\Kernel as LaravelHttpKernel;
6
7
/**
8
 * Class PortHttpKernel
9
 *
10
 * A.K.A (app/Http/Kernel.php)
11
 *
12
 * @author  Mahmoud Zalt  <[email protected]>
13
 */
14
class PortHttpKernel extends LaravelHttpKernel
15
{
16
17
    /**
18
     * The application's global HTTP middleware stack.
19
     *
20
     * @var array
21
     */
22
    protected $middleware = [
23
        // Laravel default middleware's:
24
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
25
        // CORS package middleware
26
        \Barryvdh\Cors\HandleCors::class,
27
    ];
28
29
    /**
30
     * The application's route middleware groups.
31
     *
32
     * @var array
33
     */
34
    protected $middlewareGroups = [
35
        'web' => [
36
            // Laravel default middleware's:
37
            \App\Port\Middleware\Http\EncryptCookies::class,
38
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
39
            \Illuminate\Session\Middleware\StartSession::class,
40
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
41
            \App\Port\Middleware\Http\VerifyCsrfToken::class,
42
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
43
        ],
44
        'api' => [
45
            // Laravel default middleware's:
46
            'bindings',
47
            // Hello API Localization middleware
48
            \App\Port\Middleware\Http\Localization::class,
49
            // Dingo Package throttle middleware
50
            'api.throttle',
51
        ],
52
    ];
53
54
    /**
55
     * The application's route middleware.
56
     *
57
     * @var array
58
     */
59
    protected $routeMiddleware = [
60
61
    ];
62
63
64
    /**
65
     * @param array $middlewares
66
     *
67
     * @return  $this
68
     */
69
    public function registerMiddlewares(array $middlewares = [])
70
    {
71
        $this->middleware = array_merge($this->middleware, $middlewares);
72
73
        return $this;
74
    }
75
76
    /**
77
     * @param array $middlewareGroups
78
     *
79
     * @return  $this
80
     */
81
    public function registerMiddlewareGroups(array $middlewareGroups = [])
82
    {
83
        $this->middlewareGroups = array_merge($this->middlewareGroups, $middlewareGroups);
84
85
        return $this;
86
    }
87
88
}
89