BaseMiddleware::handleNext()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 6
rs 9.4285
cc 2
eloc 3
nc 2
nop 0
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