Completed
Push — master ( f445a9...55498a )
by Camilo
02:27
created

PingReq   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 19
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createPayload() 0 3 1
A createVariableHeader() 0 3 1
A shouldExpectAnswer() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace unreal4u\MQTT\Protocol;
6
7
use unreal4u\MQTT\Internals\ProtocolBase;
8
use unreal4u\MQTT\Internals\WritableContent;
9
use unreal4u\MQTT\Internals\WritableContentInterface;
10
11
/**
12
 * The PINGREQ Packet is sent from a Client to the Server. It can be used to:
13
 *
14
 * - Indicate to the Server that the Client is alive in the absence of any other Control Packets being sent from the
15
 *   Client to the Server.
16
 * - Request that the Server responds to confirm that it is alive.
17
 * - Exercise the network to indicate that the Network Connection is active.
18
 */
19
final class PingReq extends ProtocolBase implements WritableContentInterface
20
{
21
    use WritableContent;
22
23
    const CONTROL_PACKET_VALUE = 12;
24
25 2
    public function createVariableHeader(): string
26
    {
27 2
        return '';
28
    }
29
30 2
    public function createPayload(): string
31
    {
32 2
        return '';
33
    }
34
35 1
    public function shouldExpectAnswer(): bool
36
    {
37 1
        return true;
38
    }
39
}
40