ConnectionFactory::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
3
namespace gries\Rcon;
4
5
/**
6
 * Class ConnectionFactory
7
 *
8
 * @package gries\Rcon
9
 */
10
class ConnectionFactory
11
{
12
    /**
13
     * Create a new RconConnection
14
     *
15
     * @param $host
16
     * @param $port
17
     * @param $password
18
     *
19
     * @return \gries\Rcon\Connection
20
     */
21
    public static function create($host, $port, $password)
22
    {
23
        $factory = new \Socket\Raw\Factory();
24
        $socket = $factory->createClient(sprintf('%s:%s', $host, $port));
25
26
        return new \gries\Rcon\Connection($socket, $password);
27
    }
28
}
29