Passed
Push — master ( c1f248...257530 )
by Camilo
01:51
created

PubRec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
dl 0
loc 53
c 0
b 0
f 0
ccs 0
cts 11
cp 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A createPayload() 0 4 1
A shouldExpectAnswer() 0 3 1
A fillObject() 0 4 1
A expectAnswer() 0 3 1
A createVariableHeader() 0 4 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\ReadableContent;
9
use unreal4u\MQTT\Internals\ReadableContentInterface;
10
use unreal4u\MQTT\Internals\WritableContent;
11
use unreal4u\MQTT\Internals\WritableContentInterface;
12
13
final class PubRec extends ProtocolBase implements ReadableContentInterface, WritableContentInterface
14
{
15
    use ReadableContent;
16
    use WritableContent;
17
18
    public $packetIdentifier = 0;
19
20
    const CONTROL_PACKET_VALUE = 5;
21
22
    public function fillObject(string $rawMQTTHeaders): 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
     * What specific kind of post we should expect back from this request
50
     *
51
     * @param string $data
52
     * @return ReadableContentInterface
53
     */
54
    public function expectAnswer(string $data): ReadableContentInterface
55
    {
56
        return $this;
57
    }
58
59
    /**
60
     * Some responses won't expect an answer back, others do in some situations
61
     * @return bool
62
     */
63
    public function shouldExpectAnswer(): bool
64
    {
65
        return false;
66
    }
67
}
68