PingReq   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 20
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createPayload() 0 3 1
A shouldExpectAnswer() 0 3 1
A createVariableHeader() 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 /** @noinspection TraitsPropertiesConflictsInspection */
22 1
        WritableContent;
23
24
    private const CONTROL_PACKET_VALUE = 12;
25
26 2
    public function createVariableHeader(): string
27
    {
28 2
        return '';
29
    }
30
31 2
    public function createPayload(): string
32
    {
33 2
        return '';
34
    }
35
36 1
    public function shouldExpectAnswer(): bool
37
    {
38 1
        return true;
39
    }
40
}
41