ImmediateDispatchTerminator   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A terminate() 0 4 1
A getStageContextClass() 0 4 1
A getNextStageContextClass() 0 4 1
1
<?php
2
namespace PSB\Core\Pipeline\Outgoing;
3
4
5
use PSB\Core\Pipeline\Outgoing\StageContext\DispatchContext;
6
use PSB\Core\Pipeline\PipelineTerminator;
7
use PSB\Core\Transport\MessageDispatcherInterface;
8
use PSB\Core\Transport\TransportOperations;
9
10
class ImmediateDispatchTerminator extends PipelineTerminator
11
{
12
    /**
13
     * @var MessageDispatcherInterface
14
     */
15
    private $messageDispatcher;
16
17
    /**
18
     * @param MessageDispatcherInterface $messageDispatcher
19
     */
20 4
    public function __construct(MessageDispatcherInterface $messageDispatcher)
21
    {
22 4
        $this->messageDispatcher = $messageDispatcher;
23 4
    }
24
25
    /**
26
     * @param DispatchContext $context
27
     */
28 1
    protected function terminate($context)
29
    {
30 1
        $this->messageDispatcher->dispatch(new TransportOperations($context->getTransportOperations()));
31 1
    }
32
33
    /**
34
     * @return string
35
     */
36 1
    public static function getStageContextClass()
37
    {
38 1
        return DispatchContext::class;
39
    }
40
41
    /**
42
     * @return string
43
     */
44 1
    public static function getNextStageContextClass()
45
    {
46 1
        return '';
47
    }
48
}
49