SubscribeTerminator   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
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\Routing\Pipeline;
3
4
5
use PSB\Core\Pipeline\Outgoing\StageContext\SubscribeContext;
6
use PSB\Core\Pipeline\PipelineTerminator;
7
use PSB\Core\Transport\SubscriptionManagerInterface;
8
9
class SubscribeTerminator extends PipelineTerminator
10
{
11
    /**
12
     * @var SubscriptionManagerInterface
13
     */
14
    private $subscriptionManager;
15
16
    /**
17
     * @param SubscriptionManagerInterface $subscriptionManager
18
     */
19 4
    public function __construct(SubscriptionManagerInterface $subscriptionManager)
20
    {
21 4
        $this->subscriptionManager = $subscriptionManager;
22 4
    }
23
24
    /**
25
     * @param SubscribeContext $context
26
     */
27 1
    protected function terminate($context)
28
    {
29 1
        $this->subscriptionManager->subscribe($context->getEventFqcn());
30 1
    }
31
32
    /**
33
     * @return string
34
     */
35 1
    public static function getStageContextClass()
36
    {
37 1
        return SubscribeContext::class;
38
    }
39
40
    /**
41
     * @return string
42
     */
43 1
    public static function getNextStageContextClass()
44
    {
45 1
        return '';
46
    }
47
}
48