SuccessCurlResponseDto   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 125
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 12
eloc 25
c 0
b 0
f 0
dl 0
loc 125
rs 10

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getReturnMessage() 0 3 1
A setNextPageCursor() 0 4 1
A getReturnExtendedInfo() 0 3 1
A setBody() 0 4 1
A getResult() 0 3 1
A setTime() 0 4 1
A setReturnExtendedInfo() 0 4 1
A getNextPageCursor() 0 3 1
A getTime() 0 3 1
A setReturnMessage() 0 4 1
A setReturnCode() 0 4 1
A getReturnCode() 0 3 1
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Core\Response;
4
5
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
6
use Carpenstar\ByBitAPI\Core\Interfaces\ICollectionInterface;
7
use Carpenstar\ByBitAPI\Core\Interfaces\ISuccessCurlResponseDtoInterface;
8
9
class SuccessCurlResponseDto implements ISuccessCurlResponseDtoInterface
10
{
11
    /**
12
     * @var \DateTime $time
13
     */
14
    private \DateTime $time;
15
    /**
16
     * @var int $retCode
17
     */
18
    private int $retCode;
19
20
    /**
21
     * @var string $retMsg
22
     */
23
    private string $retMsg;
24
25
    /**
26
     * @var array $retExtInfo
27
     */
28
    private array $retExtInfo = [];
29
30
    private string $nextPageCursor;
31
32
    private ICollectionInterface $body;
33
34
35
    /**
36
     * @param int $code
37
     * @return SuccessCurlResponseDto
38
     */
39
    public function setReturnCode(int $code): self
40
    {
41
        $this->retCode = $code;
42
        return $this;
43
    }
44
45
    /**
46
     * @return int
47
     */
48
    public function getReturnCode(): int
49
    {
50
        return $this->retCode;
51
    }
52
53
    /**
54
     * @param string $message
55
     * @return SuccessCurlResponseDto
56
     */
57
    public function setReturnMessage(string $message): self
58
    {
59
        $this->retMsg = $message;
60
        return $this;
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function getReturnMessage(): string
67
    {
68
        return $this->retMsg;
69
    }
70
71
    /**
72
     * @param array $extInfo
73
     * @return SuccessCurlResponseDto
74
     */
75
    public function setReturnExtendedInfo(array $extInfo): self
76
    {
77
        $this->retExtInfo = $extInfo;
78
        return $this;
79
    }
80
81
    /**
82
     * @return array
83
     */
84
    public function getReturnExtendedInfo(): array
85
    {
86
        return $this->retExtInfo;
87
    }
88
89
    /**
90
     * @param int $time
91
     * @return SuccessCurlResponseDto
92
     */
93
    public function setTime(int $time): self
94
    {
95
        $this->time = DateTimeHelper::makeFromTimestamp($time);
96
        return $this;
97
    }
98
99
    /**
100
     * @return \DateTime
101
     */
102
    public function getTime(): \DateTime
103
    {
104
        return $this->time;
105
    }
106
107
    /**
108
     * @param $collection
109
     * @return $this
110
     */
111
    public function setBody($collection): self
112
    {
113
        $this->body = $collection;
114
        return $this;
115
    }
116
117
    /**
118
     * @return array|null
119
     */
120
    public function getResult(): ICollectionInterface
121
    {
122
        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...
123
    }
124
125
    public function setNextPageCursor(string $cursor): self
126
    {
127
        $this->nextPageCursor = $cursor;
128
        return $this;
129
    }
130
131
    public function getNextPageCursor(): ?string
132
    {
133
        return $this->nextPageCursor;
134
    }
135
}
136