Test Failed
Push — master ( 82b045...1f684d )
by Mike
04:10
created

RabbitMQFacade   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 36
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A runWorker() 0 3 1
A init() 0 3 1
A sendMessages() 0 3 1
A close() 0 3 1
A sendMessage() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Xervice\RabbitMQ\Business;
5
6
use DataProvider\RabbitMqMessageCollectionDataProvider;
7
use DataProvider\RabbitMqMessageDataProvider;
8
use Xervice\Core\Business\Model\Facade\AbstractFacade;
9
10
11
/**
12
 * @method \Xervice\RabbitMQ\Business\RabbitMQBusinessFactory getFactory()
13
 * @method \Xervice\RabbitMQ\RabbitMQConfig getConfig()
14
 */
15
class RabbitMQFacade extends AbstractFacade
16
{
17
    /**
18
     * Initiate the exchanges and queues in RabbitMQ
19
     *
20
     * @api
21
     */
22
    public function init(): void
23
    {
24
        $this->getFactory()->createBootstrapper()->boot();
25
    }
26
27
    public function runWorker(): void
28
    {
29
        $this->getFactory()->createWorker()->runWorker();
30
    }
31
32
    public function close(): void
33
    {
34
        $this->getFactory()->getConnectionProvider()->getConnection()->close();
35
    }
36
37
    /**
38
     * @param \DataProvider\RabbitMqMessageDataProvider $messageDataProvider
39
     */
40
    public function sendMessage(RabbitMqMessageDataProvider $messageDataProvider): void
41
    {
42
        $this->getFactory()->getMessageProvider()->sendMessage($messageDataProvider);
43
    }
44
45
    /**
46
     * @param \DataProvider\RabbitMqMessageCollectionDataProvider $messageCollectionDataProvider
47
     */
48
    public function sendMessages(RabbitMqMessageCollectionDataProvider $messageCollectionDataProvider): void
49
    {
50
        $this->getFactory()->getMessageProvider()->sendBulk($messageCollectionDataProvider);
51
    }
52
}
53