Conditions | 4 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
39 | protected function connect($address) |
||
40 | { |
||
41 | if (filter_var($address, FILTER_VALIDATE_IP) || preg_match("/:/", $address)) { |
||
42 | if (filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { |
||
43 | $address = 'http://' . $address; |
||
44 | } |
||
45 | |||
46 | $url = parse_url($address); |
||
47 | |||
48 | $host = $url['host'] ?? null; |
||
49 | $port = $url['port'] ?? null; |
||
50 | } else { |
||
51 | // For UNIX sockets |
||
52 | $host = $address; |
||
53 | $port = null; |
||
54 | } |
||
55 | |||
56 | return @socket_connect($this->resource, $host, $port); |
||
57 | } |
||
82 |