Socket   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A listen() 0 3 1
A connect() 0 3 1
1
<?php
2
/**
3
 * EV Socket
4
 * User: moyo
5
 * Date: 02/08/2017
6
 * Time: 10:09 AM
7
 */
8
9
namespace Carno\Socket;
10
11
use Carno\Net\Address;
12
use Carno\Net\Events;
13
use Carno\Socket\Contracts\TClient;
14
use Carno\Socket\Contracts\TServer;
15
use Carno\Socket\Powered\Swoole\Client;
16
use Carno\Socket\Powered\Swoole\Server;
17
18
class Socket
19
{
20
    /**
21
     * @param Address $address
22
     * @param Events $events
23
     * @param Options $options
24
     * @return TClient
25
     */
26
    public static function connect(Address $address, Events $events, Options $options = null) : TClient
27
    {
28
        return (new Client)->connect($address, $events, $options);
29
    }
30
31
    /**
32
     * @param Address $address
33
     * @param Events $events
34
     * @param Options $options
35
     * @return TServer
36
     */
37
    public static function listen(Address $address, Events $events, Options $options = null) : TServer
38
    {
39
        return (new Server)->listen($address, $events, $options);
40
    }
41
}
42