ChainProcessDecorator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 34
c 0
b 0
f 0
ccs 10
cts 10
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A execute() 0 8 2
1
<?php
2
3
namespace SRIO\ChainOfResponsibility;
4
5
final class ChainProcessDecorator implements ChainProcessInterface
6
{
7
    /**
8
     * @var ChainProcessInterface
9
     */
10
    private $process;
11
12
    /**
13
     * @var ChainProcessInterface
14
     */
15
    private $nextProcess;
16
17
    /**
18
     * @param ChainProcessInterface $process
19
     * @param ChainProcessInterface $nextProcess
20
     */
21 7
    public function __construct(ChainProcessInterface $process, ChainProcessInterface $nextProcess = null)
22
    {
23 7
        $this->process = $process;
24 7
        $this->nextProcess = $nextProcess;
25 7
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 7
    public function execute(ChainContext $context)
31
    {
32 7
        $this->process->execute($context);
33
34 7
        if (null !== $this->nextProcess) {
35 5
            $this->nextProcess->execute($context);
36 5
        }
37 7
    }
38
}
39