Completed
Push — master ( 1b3824...49fa37 )
by Camilo
02:40
created

PubComp   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A fillObject() 0 4 1
A expectAnswer() 0 3 1
A createPayload() 0 4 1
A shouldExpectAnswer() 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\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 PubComp extends ProtocolBase implements ReadableContentInterface, WritableContentInterface
15
{
16
    use ReadableContent;
17
    use WritableContent;
18
19
    public $packetIdentifier = 0;
20
21
    const CONTROL_PACKET_VALUE = 7;
22
23
    public function fillObject(string $rawMQTTHeaders, ClientInterface $client): ReadableContentInterface
24
    {
25
        $this->packetIdentifier = $this->extractPacketIdentifier($rawMQTTHeaders);
26
        return $this;
27
    }
28
29
    /**
30
     * Creates the variable header that each method has
31
     * @return string
32
     */
33
    public function createVariableHeader(): string
34
    {
35
        // TODO: Implement createVariableHeader() method.
36
        return '';
37
    }
38
39
    /**
40
     * Creates the actual payload to be sent
41
     * @return string
42
     */
43
    public function createPayload(): string
44
    {
45
        // TODO: Implement createPayload() method.
46
        return '';
47
    }
48
49
    /**
50
     * @inheritdoc
51
     */
52
    public function expectAnswer(string $data, ClientInterface $client): ReadableContentInterface
53
    {
54
        return $this;
55
    }
56
57
    /**
58
     * Some responses won't expect an answer back, others do in some situations
59
     * @return bool
60
     */
61
    public function shouldExpectAnswer(): bool
62
    {
63
        return false;
64
    }
65
}
66