TunnelFactory::fromArray()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 10
rs 9.9332
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
class TunnelFactory
15
{
16
    public static function fromArray($data)
17
    {
18
        if ('http' == $data['protocol']) {
19
            $tunnel = new HttpTunnel($data['serverPort'], $data['proxyHosts']);
20
        } else {
21
            $tunnel = new TcpTunnel($data['serverPort'], $data['host']);
22
        }
23
24
        return $tunnel;
25
    }
26
}