Passed
Push — master ( bdfaa2...ebdd6d )
by Vladislav
51s queued 13s
created

CurlResponseDto   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 112
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 10
eloc 21
c 1
b 0
f 0
dl 0
loc 112
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A setReturnMessage() 0 4 1
A getTime() 0 3 1
A setTime() 0 4 1
A getBody() 0 3 1
A getReturnExtendedInfo() 0 3 1
A setReturnExtendedInfo() 0 4 1
A setReturnCode() 0 4 1
A getReturnMessage() 0 3 1
A getReturnCode() 0 3 1
A setBody() 0 4 1
1
<?php
2
namespace Carpenstar\ByBitAPI\Core\Response;
3
4
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
5
use Carpenstar\ByBitAPI\Core\Interfaces\ICollectionInterface;
6
use Carpenstar\ByBitAPI\Core\Interfaces\ICurlResponseDtoInterface;
7
8
class CurlResponseDto implements ICurlResponseDtoInterface
9
{
10
    /**
11
     * @var \DateTime $time
12
     */
13
    private \DateTime $time;
14
    /**
15
     * @var int $retCode
16
     */
17
    private int $retCode;
18
19
    /**
20
     * @var string $retMsg
21
     */
22
    private string $retMsg;
23
24
    /**
25
     * @var array $retExtInfo
26
     */
27
    private array $retExtInfo = [];
28
29
    private ICollectionInterface $body;
30
31
32
    /**
33
     * @param int $code
34
     * @return CurlResponseDto
35
     */
36
    public function setReturnCode(int $code): self
37
    {
38
        $this->retCode = $code;
39
        return $this;
40
    }
41
42
    /**
43
     * @return int
44
     */
45
    public function getReturnCode(): int
46
    {
47
        return $this->retCode;
48
    }
49
50
    /**
51
     * @param string $message
52
     * @return CurlResponseDto
53
     */
54
    public function setReturnMessage(string $message): self
55
    {
56
        $this->retMsg = $message;
57
        return $this;
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getReturnMessage(): string
64
    {
65
        return $this->retMsg;
66
    }
67
68
    /**
69
     * @param array $extInfo
70
     * @return CurlResponseDto
71
     */
72
    public function setReturnExtendedInfo(array $extInfo): self
73
    {
74
        $this->retExtInfo = $extInfo;
75
        return $this;
76
    }
77
78
    /**
79
     * @return array
80
     */
81
    public function getReturnExtendedInfo(): array
82
    {
83
        return $this->retExtInfo;
84
    }
85
86
    /**
87
     * @param int $time
88
     * @return CurlResponseDto
89
     */
90
    public function setTime(int $time): self
91
    {
92
        $this->time = DateTimeHelper::makeFromTimestamp($time);
93
        return $this;
94
    }
95
96
    /**
97
     * @return \DateTime
98
     */
99
    public function getTime(): \DateTime
100
    {
101
        return $this->time;
102
    }
103
104
    /**
105
     * @param $collection
106
     * @return $this
107
     */
108
    public function setBody($collection): self
109
    {
110
        $this->body = $collection;
111
        return $this;
112
    }
113
114
    /**
115
     * @return array|null
116
     */
117
    public function getBody(): ICollectionInterface
118
    {
119
        return $this->body;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->body returns the type Carpenstar\ByBitAPI\Core...es\ICollectionInterface which is incompatible with the documented return type array|null.
Loading history...
120
    }
121
}