EventRabbitMqBusinessFactory::getEventFacade()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace Xervice\EventRabbitMq\Business;
5
6
7
use DataProvider\RabbitMqExchangeDataProvider;
0 ignored issues
show
Bug introduced by
The type DataProvider\RabbitMqExchangeDataProvider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use DataProvider\RabbitMqQueueBindDataProvider;
0 ignored issues
show
Bug introduced by
The type DataProvider\RabbitMqQueueBindDataProvider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use DataProvider\RabbitMqQueueDataProvider;
0 ignored issues
show
Bug introduced by
The type DataProvider\RabbitMqQueueDataProvider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Xervice\Core\Business\Model\Factory\AbstractBusinessFactory;
11
use Xervice\Event\Business\EventFacade;
12
use Xervice\EventRabbitMq\EventRabbitMqDependencyProvider;
13
use Xervice\RabbitMQ\Business\RabbitMQFacade;
14
15
/**
16
 * @method \Xervice\EventRabbitMq\EventRabbitMqConfig getConfig()
17
 */
18
class EventRabbitMqBusinessFactory extends AbstractBusinessFactory
19
{
20
21
    /**
22
     * @return \DataProvider\RabbitMqQueueBindDataProvider
23
     */
24 1
    public function createBindQueue(): RabbitMqQueueBindDataProvider
25
    {
26 1
        return (new RabbitMqQueueBindDataProvider())
27 1
            ->setQueue(
28 1
                $this->createEventQueue()
29
            )
30 1
            ->setExchange(
31 1
                $this->createEventExchange()
32
            );
33
    }
34
35 1
    public function createEventExchange(): RabbitMqExchangeDataProvider
36
    {
37 1
        return (new RabbitMqExchangeDataProvider())
38 1
            ->setName(
39 1
                $this->getConfig()->getExchangeName()
40
            )
41 1
            ->setAutoDelete(false)
42 1
            ->setType('fanout');
43
    }
44
45
    /**
46
     * @return \DataProvider\RabbitMqQueueDataProvider
47
     */
48 1
    public function createEventQueue(): RabbitMqQueueDataProvider
49
    {
50 1
        return (new RabbitMqQueueDataProvider())
51 1
            ->setName($this->getConfig()->getQueueName())
52 1
            ->setAutoDelete(false);
53
    }
54
55
    /**
56
     * @return \Xervice\RabbitMQ\Business\RabbitMQFacade
57
     */
58
    public function getRabbitMqFacade(): RabbitMQFacade
59
    {
60
        return $this->getDependency(EventRabbitMqDependencyProvider::RABBITMQ_FACADE);
61
    }
62
63
    /**
64
     * @return \Xervice\Event\Business\EventFacade
65
     */
66
    public function getEventFacade(): EventFacade
67
    {
68
        return $this->getDependency(EventRabbitMqDependencyProvider::EVENT_FACADE);
69
    }
70
}