Publisher   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 30
loc 30
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 17 17 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Cmp\Queues\Infrastructure\AmqpLib\v26\RabbitMQ\DomainEvent;
4
5
use Cmp\Queues\Domain\Event\Publisher as DomainPublisher;
6
use Cmp\Queues\Infrastructure\AmqpLib\v26\RabbitMQ\Queue\Config\ExchangeConfig;
7
use Cmp\Queues\Infrastructure\AmqpLib\v26\RabbitMQ\Queue\QueueWriter;
8
use PhpAmqpLib\Connection\AMQPLazyConnection;
9
use Psr\Log\LoggerInterface;
10
11
12 View Code Duplication
class Publisher extends DomainPublisher
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    /**
15
     * Publisher constructor.
16
     * @param string $host
17
     * @param int $port
18
     * @param string $user
19
     * @param string $password
20
     * @param string $vHost
21
     * @param string $exchangeName
22
     * @param LoggerInterface $logger
23
     */
24
    public function __construct(
25
        $host,
26
        $port,
27
        $user,
28
        $password,
29
        $vHost,
30
        $exchangeName,
31
        LoggerInterface $logger
32
    )
33
    {
34
        $queueWriter = new QueueWriter(
35
            new AMQPLazyConnection($host, $port, $user, $password, $vHost),
36
            new ExchangeConfig($exchangeName, 'topic', false, true, false),
37
            $logger
38
        );
39
        parent::__construct($queueWriter);
40
    }
41
}