AbstractHandler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 7
c 1
b 0
f 0
dl 0
loc 20
ccs 9
cts 9
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 4 2
A setNext() 0 5 1
1
<?php
2
3
namespace Chain;
4
5
class AbstractHandler implements HandlerInterface
6
{
7
    private ?HandlerInterface $next;
8
9 2
    public function __construct()
10
    {
11 2
        $this->next = null;
12 2
    }
13
14 2
    public function setNext(HandlerInterface $handler): HandlerInterface
15
    {
16 2
        $this->next = $handler;
17
18 2
        return $handler;
19
    }
20
21 2
    public function handle(ContextInterface $context)
22
    {
23 2
        if ($this->next) {
24 2
            return $this->next->handle($context);
25
        }
26
    }
27
}