BaseMiddleware   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 18
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A handleNext() 0 6 2
1
<?php
2
3
namespace App\Middlewares;
4
5
use App\Middlewares\Contracts\IMiddleware;
6
7
abstract class BaseMiddleware implements IMiddleware
8
{
9
    protected $next;
10
11
    public function __construct($next)
12
    {
13
        if ($next instanceof IMiddleware) {
14
            $this->next = $next;
15
        }
16
    }
17
18
    public function handleNext()
19
    {
20
        if (!is_null($this->next)) {
21
            $this->next->handle();
22
        }
23
    }
24
}
25