ExceptionResponse::isSuccess()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Core\Objects;
4
5
use Carpenstar\ByBitAPI\Core\Helpers\BoolHelper;
6
use Carpenstar\ByBitAPI\Core\Helpers\StringHelper;
7
use Carpenstar\ByBitAPI\Core\Interfaces\IResponseDataInterface;
8
use Carpenstar\ByBitAPI\Core\Objects\Collection\EntityCollection;
9
10
class ExceptionResponse implements IResponseDataInterface
11
{
12
    private bool $isSuccess;
13
    private string $retMsg;
14
    private \DateTime $time;
15
16
    public function __construct(array $data)
17
    {
18
        $this->isSuccess = BoolHelper::assign($data['success']);
19
        $this->retMsg = StringHelper::assign($data['ret_msg']);
20
        $this->time = (new \DateTime());
21
        $this->result = new EntityCollection();
0 ignored issues
show
Bug Best Practice introduced by
The property result does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
22
    }
23
24
    public function isSuccess(): bool
25
    {
26
        return $this->isSuccess;
27
    }
28
29
    public function getReturnMessage(): string
30
    {
31
        return $this->retMsg;
32
    }
33
34
    public function getTime(): \DateTime
35
    {
36
        return $this->time;
37
    }
38
}
39