Passed
Push — master ( dde472...6978f3 )
by Alexpts
01:57
created

Socket   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 1
dl 0
loc 19
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A connect() 0 9 1
1
<?php
2
declare(strict_types=1);
3
4
namespace PTS\Transport;
5
6
class Socket extends BaseTransport
7
{
8
9
    /**
10
     * @param string $address
11
     * @param array $options
12
     *
13
     * @return TransportInterface
14
     */
15
    public function connect(string $address, array $options = []): TransportInterface
16
    {
17
        $timeout = (float)($options['timeout'] ??(float) ini_get('default_socket_timeout'));
18
        $port = $options['port'] ?? 0;
19
        $url = $this->schema . $address;
20
        $this->target = @fsockopen($url, $port, $this->errorNumber, $this->errorMessage, $timeout);
21
22
        return $this;
23
    }
24
}
25