OpenInterestResponseItem   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 34
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getOpenInterest() 0 3 1
A getTimestamp() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Derivatives\MarketData\OpenInterest\Response;
4
5
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
6
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
7
8
class OpenInterestResponseItem extends AbstractResponse
9
{
10
    /**
11
     * Open interest
12
     * @var float $openInterest
13
     */
14
    private float $openInterest;
15
16
    /**
17
     * The timestamp
18
     * @var \DateTime $timestamp
19
     */
20
    private \DateTime $timestamp;
21
22
    public function __construct(array $data)
23
    {
24
        $this->openInterest = $data['openInterest'];
25
        $this->timestamp = DateTimeHelper::makeFromTimestamp($data['timestamp']);
26
    }
27
28
    /**
29
     * @return float
30
     */
31
    public function getOpenInterest(): float
32
    {
33
        return $this->openInterest;
34
    }
35
36
    /**
37
     * @return \DateTime
38
     */
39
    public function getTimestamp(): \DateTime
40
    {
41
        return $this->timestamp;
42
    }
43
}
44