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

UdpSocket::isConnected()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
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