SocketConnectionFactory::createConnection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

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