Test Setup Failed
Push — master ( 246aa3...2d0e6f )
by Alexpts
01:50
created

UdpSocket   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 25
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace PTS\Transport\Udp;
5
6
use PTS\Transport\Socket;
7
8
class UdpSocket extends Socket
9
{
10
11
    protected bool $isConnected = false;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
12
    protected string $schema = 'udp://';
13
14
    public function connect(string $address, array $options = []): static
15
    {
16
        $this->isConnected = true;
17 4
        return parent::connect($address, $options);
18
    }
19 4
20 4
    public function isConnected(): bool
21
    {
22
        return $this->isConnected && $this->target !== null;
23 4
    }
24
25 4
    public function close(): void
26
    {
27
        parent::close();
28 4
        $this->isConnected = false;
29
    }
30
}
31