Passed
Push — master ( 3894cc...b6588e )
by Vladislav
06:30 queued 04:28
created

WebSocketConnectionResponse   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 16
c 1
b 0
f 0
dl 0
loc 40
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A isSuccess() 0 3 1
A getReturnMessage() 0 3 1
A getOperation() 0 3 1
A getConnectionId() 0 3 1
A getReqId() 0 3 1
A __construct() 0 7 1
1
<?php
2
namespace Carpenstar\ByBitAPI\Core\Objects\WebSockets\Entity;
3
4
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
5
6
class WebSocketConnectionResponse extends AbstractResponse
7
{
8
    private bool $success;
9
    private ?string $returnMessage;
10
    private string $connectionId;
11
    private ?string $reqId;
12
    private string $operation;
13
14
    public function __construct(array $data)
15
    {
16
        $this->success = $data['success'];
17
        $this->returnMessage = $data['retm_msg'] ?? null;
18
        $this->connectionId = $data['conn_id'];
19
        $this->reqId = $data['req_id'] ?? null;
20
        $this->operation = $data['op'];
21
    }
22
23
    public function isSuccess(): bool
24
    {
25
        return $this->success;
26
    }
27
28
    public function getReturnMessage(): ?string
29
    {
30
        return $this->returnMessage;
31
    }
32
33
    public function getConnectionId(): string
34
    {
35
        return $this->connectionId;
36
    }
37
38
    public function getReqId(): ?string 
39
    {
40
        return $this->reqId;
41
    }
42
43
    public function getOperation(): string
44
    {
45
        return $this->operation;
46
    }
47
}
48