OpenInterestResponseItem::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
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