Test Failed
Push — main ( 1525b1...f2efdb )
by Evgenii
02:07
created

MindBoxRequest::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 10
cc 1
nc 1
nop 4
crap 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A MindBoxRequest::getDeviceUUID() 0 3 1
1
<?php
2
3
4
namespace floor12\MindBox;
5
6
7
abstract class MindBoxRequest
8
{
9
    /** @var string */
10
    protected $operationName;
11
    /** @var array */
12
    protected $body = [];
13
    /** @var string|null */
14
    protected $deviceUUID;
15
    /** @var int */
16
    protected $mode = MindBoxClient::MODE_SYNCHRONOUS;
17
18
    /**
19
     * @return string
20
     */
21 2
    public function getOperationName()
22
    {
23 2
        return $this->operationName;
24
    }
25
26
    /**
27
     * @return string|null
28
     */
29 2
    public function getDeviceUUID(): ?string
30
    {
31 2
        return $this->deviceUUID;
32
    }
33
34
    /**
35
     * @return array
36
     */
37 2
    public function getBody(): array
38
    {
39 2
        return $this->body;
40
    }
41
42
    /**
43
     * @return string
44
     */
45 2
    public function getBodyAsJson(): string
46
    {
47 2
        return json_encode($this->body);
48
    }
49
50
    /**
51
     * @return int
52
     */
53 1
    public function getMode(): int
54
    {
55 1
        return $this->mode;
56
    }
57
58
    /**
59
     * @return bool
60
     */
61 2
    public function isAsync(): bool
62
    {
63 2
        return $this->mode === MindBoxClient::MODE_ASYNCHRONOUS;
64
    }
65
66
    /**
67
     * @param string|null $deviceUUID
68
     */
69 1
    public function setDeviceUUID(?string $deviceUUID): void
70
    {
71 1
        $this->deviceUUID = $deviceUUID;
72 1
    }
73
74
    /**
75
     * @param int $mode
76
     */
77 3
    public function setMode(int $mode): void
78
    {
79 3
        $this->mode = $mode;
80 3
    }
81
82
    /**
83
     * @param mixed $operationName
84
     */
85 1
    public function setOperationName($operationName): void
86
    {
87 1
        $this->operationName = $operationName;
88 1
    }
89
90
    /**
91
     * @param array $body
92
     */
93 2
    public function setBody(array $body): void
94
    {
95 2
        $this->body = $body;
96 2
    }
97
98
99
}
100