Completed
Push — master ( accf18...c40548 )
by Camilo
02:13
created

PingResp::getOriginControlPacket()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 2
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
    use ReadableContent;
21
22
    const CONTROL_PACKET_VALUE = 13;
23
24
    /**
25
     * @inheritdoc
26
     */
27
    public function performSpecialActions(ClientInterface $client, WritableContentInterface $originalRequest): bool
28
    {
29
        $client->updateLastCommunication();
30
        return true;
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function getOriginControlPacket(): int
37
    {
38
        return PingReq::getControlPacketValue();
39
    }
40
}
41