Tunnel::getServerPort()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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
abstract class Tunnel implements TunnelInterface
15
{
16
    /**
17
     * The tunnel server port.
18
     *
19
     * @var int
20
     */
21
    protected $serverPort;
22
23
    public function __construct($serverPort)
24
    {
25
        $this->serverPort = $serverPort;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getServerPort()
32
    {
33
        return $this->serverPort;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function match($info)
40
    {
41
        return $this->getServerPort() == $info['serverPort'];
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function jsonSerialize()
48
    {
49
        return $this->toArray();
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function __toString()
56
    {
57
        return json_encode($this->toArray());
58
    }
59
}