Passed
Push — master ( 4e34bd...29d761 )
by Alexpts
02:16
created

TcpSocket::write()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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