ImmediateDispatchTerminator::terminate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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