RabbitMqSubscriptionManager::subscribe()   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\Transport\RabbitMq;
3
4
5
use PSB\Core\Transport\SubscriptionManagerInterface;
6
7
class RabbitMqSubscriptionManager implements SubscriptionManagerInterface
8
{
9
    /**
10
     * @var BrokerModel
11
     */
12
    private $brokerModel;
13
14
    /**
15
     * @var RoutingTopology
16
     */
17
    private $routingTopology;
18
19
    /**
20
     * @var string
21
     */
22
    private $localQueue;
23
24
    /**
25
     * @param BrokerModel     $brokerModel
26
     * @param RoutingTopology $routingTopology
27
     * @param string          $localQueue
28
     */
29 3
    public function __construct(BrokerModel $brokerModel, RoutingTopology $routingTopology, $localQueue)
30
    {
31 3
        $this->brokerModel = $brokerModel;
32 3
        $this->routingTopology = $routingTopology;
33 3
        $this->localQueue = $localQueue;
34 3
    }
35
36
    /**
37
     * @param string $eventFqcn
38
     */
39 1
    public function subscribe($eventFqcn)
40
    {
41 1
        $this->routingTopology->setupSubscription($this->brokerModel, $eventFqcn, $this->localQueue);
42 1
    }
43
44
    /**
45
     * @param string $eventFqcn
46
     */
47 1
    public function unsubscribe($eventFqcn)
48
    {
49 1
        $this->routingTopology->tearDownSubscription($this->brokerModel, $eventFqcn, $this->localQueue);
50 1
    }
51
}
52