Passed
Push — main ( 31df87...01449a )
by Evgenii
02:07
created

MindBoxRequest::isAsync()   A

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
4
namespace floor12\MindBox\Requests;
5
6
7
use floor12\MindBox\MindBoxClient;
8
9
abstract class MindBoxRequest
10
{
11
    /** @var string */
12
    protected $operationName;
13
    /** @var array */
14
    protected $body = [];
15
    /** @var string|null */
16
    protected $deviceUUID;
17
    /** @var int */
18
    protected $mode = MindBoxClient::MODE_SYNCHRONOUS;
19
20
    /**
21
     * @return string
22
     */
23 1
    public function getOperationName()
24
    {
25 1
        return $this->operationName;
26
    }
27
28
    /**
29
     * @return string|null
30
     */
31 1
    public function getDeviceUUID(): ?string
32
    {
33 1
        return $this->deviceUUID;
34
    }
35
36
    /**
37
     * @return array
38
     */
39
    public function getBody(): array
40
    {
41
        return $this->body;
42
    }
43
44
    /**
45
     * @return string
46
     */
47 1
    public function getBodyAsJson(): string
48
    {
49 1
        return json_encode($this->body);
50
    }
51
52
    /**
53
     * @return int
54
     */
55
    public function getMode(): int
56
    {
57
        return $this->mode;
58
    }
59
60
    /**
61
     * @return bool
62
     */
63 1
    public function isAsync(): bool
64
    {
65 1
        return $this->mode === MindBoxClient::MODE_ASYNCHRONOUS;
66
    }
67
}
68