SocketConnectionFactory::createConnection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

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