Test Failed
Pull Request — master (#20)
by Vladislav
08:15
created

OpenInterestResponseItem   A

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