Passed
Push — master ( 54c1b4...a67e0e )
by Vladislav
11:20 queued 09:15
created

SuccessCurlResponseDto::setBody()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 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\ISuccessCurlResponseDtoInterface;
7
8
class SuccessCurlResponseDto implements ISuccessCurlResponseDtoInterface
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 string $nextPageCursor;
30
31
    private ICollectionInterface $body;
32
33
34
    /**
35
     * @param int $code
36
     * @return SuccessCurlResponseDto
37
     */
38
    public function setReturnCode(int $code): self
39
    {
40
        $this->retCode = $code;
41
        return $this;
42
    }
43
44
    /**
45
     * @return int
46
     */
47
    public function getReturnCode(): int
48
    {
49
        return $this->retCode;
50
    }
51
52
    /**
53
     * @param string $message
54
     * @return SuccessCurlResponseDto
55
     */
56
    public function setReturnMessage(string $message): self
57
    {
58
        $this->retMsg = $message;
59
        return $this;
60
    }
61
62
    /**
63
     * @return string
64
     */
65
    public function getReturnMessage(): string
66
    {
67
        return $this->retMsg;
68
    }
69
70
    /**
71
     * @param array $extInfo
72
     * @return SuccessCurlResponseDto
73
     */
74
    public function setReturnExtendedInfo(array $extInfo): self
75
    {
76
        $this->retExtInfo = $extInfo;
77
        return $this;
78
    }
79
80
    /**
81
     * @return array
82
     */
83
    public function getReturnExtendedInfo(): array
84
    {
85
        return $this->retExtInfo;
86
    }
87
88
    /**
89
     * @param int $time
90
     * @return SuccessCurlResponseDto
91
     */
92
    public function setTime(int $time): self
93
    {
94
        $this->time = DateTimeHelper::makeFromTimestamp($time);
95
        return $this;
96
    }
97
98
    /**
99
     * @return \DateTime
100
     */
101
    public function getTime(): \DateTime
102
    {
103
        return $this->time;
104
    }
105
106
    /**
107
     * @param $collection
108
     * @return $this
109
     */
110
    public function setBody($collection): self
111
    {
112
        $this->body = $collection;
113
        return $this;
114
    }
115
116
    /**
117
     * @return array|null
118
     */
119
    public function getResult(): ICollectionInterface
120
    {
121
        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...
122
    }
123
124
    public function setNextPageCursor(string $cursor): self
125
    {
126
        $this->nextPageCursor = $cursor;
127
        return $this;
128
    }
129
130
    public function getNextPageCursor(): ?string
131
    {
132
        return $this->nextPageCursor;
133
    }
134
}