Passed
Push — master ( 63c37e...115ddb )
by Camilo
02:40
created

PubRel   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 41
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A fillObject() 0 4 1
A createVariableHeader() 0 4 1
A createPayload() 0 4 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\ClientInterface;
8
use unreal4u\MQTT\Internals\ProtocolBase;
9
use unreal4u\MQTT\Internals\ReadableContent;
10
use unreal4u\MQTT\Internals\ReadableContentInterface;
11
use unreal4u\MQTT\Internals\WritableContent;
12
use unreal4u\MQTT\Internals\WritableContentInterface;
13
14
final class PubRel extends ProtocolBase implements ReadableContentInterface, WritableContentInterface
15
{
16
    use ReadableContent, WritableContent;
17
18
    public $packetIdentifier = 0;
19
20
    const CONTROL_PACKET_VALUE = 6;
21
22
    public function fillObject(string $rawMQTTHeaders, ClientInterface $client): ReadableContentInterface
23
    {
24
        $this->packetIdentifier = $this->extractPacketIdentifier($rawMQTTHeaders);
25
        return $this;
26
    }
27
28
    /**
29
     * Creates the variable header that each method has
30
     * @return string
31
     */
32
    public function createVariableHeader(): string
33
    {
34
        // TODO: Implement createVariableHeader() method.
35
        return '';
36
    }
37
38
    /**
39
     * Creates the actual payload to be sent
40
     * @return string
41
     */
42
    public function createPayload(): string
43
    {
44
        // TODO: Implement createPayload() method.
45
        return '';
46
    }
47
48
    /**
49
     * PUBREL should ALWAYS expect an answer back (in the form of a PUBCOMP)
50
     * @return bool
51
     */
52
    public function shouldExpectAnswer(): bool
53
    {
54
        return true;
55
    }
56
}
57