TunnelFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 10 2
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
}