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

TcpSocket   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 15
ccs 4
cts 5
cp 0.8
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A connect() 0 10 2
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