Completed
Push — master ( 89265b...110e58 )
by Alexpts
01:59
created

TcpSocket::connect()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 4
cts 5
cp 0.8
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2.032
1
<?php
2
declare(strict_types=1);
3
4
namespace PTS\Transport\Tcp;
5
6
use PTS\Transport\Socket;
7
use PTS\Transport\TransportInterface;
8
use RuntimeException;
9
10
class TcpSocket extends Socket
11
{
12
    protected $schema = 'tcp://';
13
14 8
    public function connect(string $address, array $options = []): TransportInterface
15
    {
16 8
        parent::connect($address, $options);
17
18 8
        if ($this->target === false) {
19
            throw new RuntimeException('can`t open socket - ' . $this->errorNumber . ': ' . $this->errorMessage);
20
        }
21
22 8
        return $this;
23
    }
24
}
25