Completed
Push — master ( 1f684d...57b871 )
by Mike
02:29
created

ExchangeProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace Xervice\RabbitMQ\Business\Model\Core;
5
6
7
use DataProvider\RabbitMqExchangeDataProvider;
8
use PhpAmqpLib\Channel\AMQPChannel;
9
10
class ExchangeProvider implements ExchangeProviderInterface
11
{
12
    public const TYPE_DIRECT = 'direct';
13
    public const TYPE_FANOUT = 'fanout';
14
    public const TYPE_TOPIC = 'topic';
15
16
    /**
17
     * @var \PhpAmqpLib\Channel\AMQPChannel
18
     */
19
    private $channel;
20
21
    /**
22
     * Exchange constructor.
23
     *
24
     * @param \PhpAmqpLib\Channel\AMQPChannel $channel
25
     */
26 2
    public function __construct(AMQPChannel $channel)
27
    {
28 2
        $this->channel = $channel;
29 2
    }
30
31
    /**
32
     * @param \DataProvider\RabbitMqExchangeDataProvider $exchangeDataProvider
33
     */
34 2
    public function declare(RabbitMqExchangeDataProvider $exchangeDataProvider): void
0 ignored issues
show
Coding Style introduced by
Possible parse error: non-abstract method defined as abstract
Loading history...
Coding Style introduced by
It is generally advisable to only define one property per statement.

Only declaring a single property per statement allows you to later on add doc comments more easily.

It is also recommended by PSR2, so it is a common style that many people expect.

Loading history...
35
    {
36 2
        $this->channel->exchange_declare(
37 2
            $exchangeDataProvider->getName(),
38 2
            $exchangeDataProvider->getType(),
39 2
            $exchangeDataProvider->getPassive(),
40 2
            $exchangeDataProvider->getDurable(),
41 2
            $exchangeDataProvider->getAutoDelete(),
42 2
            $exchangeDataProvider->getInternal(),
43 2
            $exchangeDataProvider->getNoWait(),
44 2
            $exchangeDataProvider->getArgument(),
45 2
            $exchangeDataProvider->getTicket()
46
        );
47 2
    }
48
49
    /**
50
     * @param \DataProvider\RabbitMqExchangeDataProvider $exchangeDataProvider
51
     */
52
    public function delete(RabbitMqExchangeDataProvider $exchangeDataProvider): void
53
    {
54
        $this->channel->exchange_delete(
55
            $exchangeDataProvider->getName()
56
        );
57
    }
58
59
60
}