PingResp   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
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 26
ccs 8
cts 8
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getOriginControlPacket() 0 3 1
A performSpecialActions() 0 4 1
A fillObject() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace unreal4u\MQTT\Protocol;
6
7
use unreal4u\MQTT\Internals\ClientInterface;
8
use unreal4u\MQTT\Internals\ProtocolBase;
9
use unreal4u\MQTT\Internals\ReadableContent;
10
use unreal4u\MQTT\Internals\ReadableContentInterface;
11
use unreal4u\MQTT\Internals\WritableContentInterface;
12
13
/**
14
 * A PINGRESP Packet is sent by the Server to the Client in response to a PINGREQ Packet.
15
 *
16
 * It indicates that the Server is alive.
17
 */
18
final class PingResp extends ProtocolBase implements ReadableContentInterface
19
{
20 1
    use ReadableContent;
21
22
    private const CONTROL_PACKET_VALUE = 13;
23
24
    /**
25
     * @inheritdoc
26
     */
27 1
    public function performSpecialActions(ClientInterface $client, WritableContentInterface $originalRequest): bool
28
    {
29 1
        $client->updateLastCommunication();
30 1
        return true;
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36 1
    public function getOriginControlPacket(): int
37
    {
38 1
        return PingReq::getControlPacketValue();
39
    }
40
41 2
    public function fillObject(string $rawMQTTHeaders, ClientInterface $client): ReadableContentInterface
42
    {
43 2
        return $this;
44
    }
45
}
46