Completed
Push — master ( 257530...5ee91e )
by Camilo
01:42
created

PingReq   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 36.36%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 27
ccs 4
cts 11
cp 0.3636
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A expectAnswer() 0 6 1
A shouldExpectAnswer() 0 3 1
A createPayload() 0 3 1
A createVariableHeader() 0 3 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\ReadableContentInterface;
9
use unreal4u\MQTT\Internals\WritableContent;
10
use unreal4u\MQTT\Internals\WritableContentInterface;
11
12
final class PingReq extends ProtocolBase implements WritableContentInterface
13
{
14
    use WritableContent;
15
16
    const CONTROL_PACKET_VALUE = 12;
17
18 1
    public function createVariableHeader(): string
19
    {
20 1
        return '';
21
    }
22
23 1
    public function createPayload(): string
24
    {
25 1
        return '';
26
    }
27
28
    public function expectAnswer(string $data): ReadableContentInterface
29
    {
30
        $this->logger->info('String of incoming data confirmed, returning new object', ['class' => \get_class($this)]);
31
        $pingResp = new PingResp($this->logger);
32
        $pingResp->populate($data);
33
        return $pingResp;
34
    }
35
36
    public function shouldExpectAnswer(): bool
37
    {
38
        return true;
39
    }
40
}
41