LazyConnectionFactory::createConnection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 19
ccs 0
cts 19
cp 0
rs 9.4285
cc 1
eloc 16
nc 1
nop 1
crap 2
1
<?php
2
3
namespace RabbitMqModule\Service\Connection;
4
5
use PhpAmqpLib\Connection\AMQPLazyConnection;
6
use RabbitMqModule\Options\Connection as ConnectionOptions;
7
8
/**
9
 * Class StreamConnectionFactory.
10
 * @author Krzysztof Gzocha <[email protected]>
11
 */
12
class LazyConnectionFactory implements ConnectionFactoryInterface
13
{
14
    /**
15
     * @param ConnectionOptions $options
16
     * @return AMQPLazyConnection
17
     */
18
    public function createConnection(ConnectionOptions $options)
19
    {
20
        return new AMQPLazyConnection(
21
            $options->getHost(),
22
            $options->getPort(),
23
            $options->getUsername(),
24
            $options->getPassword(),
25
            $options->getVhost(),
26
            $options->isInsist(),
27
            $options->getLoginMethod(),
28
            null,
29
            $options->getLocale(),
30
            $options->getConnectionTimeout(),
31
            $options->getReadWriteTimeout(),
32
            null,
33
            $options->isKeepAlive(),
34
            $options->getHeartbeat()
35
        );
36
    }
37
}
38