TcpTunnel   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getHost() 0 4 1
A toArray() 0 8 1
A getProtocol() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the slince/spike package.
5
 *
6
 * (c) Slince <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Spike\Common\Tunnel;
13
14
class TcpTunnel extends Tunnel
15
{
16
    /**
17
     * @var string
18
     */
19
    protected $host;
20
21
    public function __construct($serverPort, $host)
22
    {
23
        $this->host = $host;
24
        parent::__construct($serverPort);
25
    }
26
27
    /**
28
     * Gets the local host.
29
     *
30
     * @return string
31
     */
32
    public function getHost()
33
    {
34
        return $this->host;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function toArray()
41
    {
42
        return [
43
            'protocol' => $this->getProtocol(),
44
            'host' => $this->host,
45
            'serverPort' => $this->serverPort,
46
        ];
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getProtocol()
53
    {
54
        return 'tcp';
55
    }
56
}