EmptyWritableResponse::shouldExpectAnswer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace unreal4u\MQTT\Application;
6
7
use unreal4u\MQTT\Internals\ProtocolBase;
8
use unreal4u\MQTT\Internals\WritableContent;
9
use unreal4u\MQTT\Internals\WritableContentInterface;
10
11
/**
12
 * This is an example of a payload class that performs some processing on the data
13
 *
14
 * This particular case will prepend a datetime to the message itself. It will json_encode() it into the payload and
15
 * when retrieving it will set the public property $originalPublishDateTime.
16
 */
17
final class EmptyWritableResponse extends ProtocolBase implements WritableContentInterface
18
{
19
    use /** @noinspection TraitsPropertiesConflictsInspection */
20 1
        WritableContent;
21
22
    private const CONTROL_PACKET_VALUE = 0;
23
24
    /**
25
     * Creates the variable header that each method has
26
     * @return string
27
     */
28 1
    public function createVariableHeader(): string
29
    {
30 1
        return '';
31
    }
32
33
    /**
34
     * Creates the actual payload to be sent
35
     * @return string
36
     */
37 1
    public function createPayload(): string
38
    {
39 1
        return '';
40
    }
41
42
    /**
43
     * Some responses won't expect an answer back, others do in some situations
44
     * @return bool
45
     */
46 1
    public function shouldExpectAnswer(): bool
47
    {
48 1
        return false;
49
    }
50
}
51