| Total Complexity | 5 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class OpenInterestResponse extends ResponseEntity |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Open interest |
||
| 11 | * @var string $openInterest |
||
| 12 | */ |
||
| 13 | private string $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 |
||
| 24 | ->setOpenInterest($data['openInterest']) |
||
| 25 | ->setTimestamp($data['timestamp']); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param string $openInterest |
||
| 30 | * @return OpenInterestResponse |
||
| 31 | */ |
||
| 32 | public function setOpenInterest(string $openInterest): self |
||
| 33 | { |
||
| 34 | $this->openInterest = $openInterest; |
||
| 35 | return $this; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return string |
||
| 40 | */ |
||
| 41 | public function getOpenInterest(): string |
||
| 42 | { |
||
| 43 | return $this->openInterest; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @param int $timestamp |
||
| 48 | * @return OpenInterestResponse |
||
| 49 | */ |
||
| 50 | private function setTimestamp(int $timestamp): self |
||
| 51 | { |
||
| 52 | $this->timestamp = DateTimeHelper::makeFromTimestamp($timestamp); |
||
| 53 | return $this; |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return \DateTime |
||
| 58 | */ |
||
| 59 | public function getTimestamp(): \DateTime |
||
| 62 | } |
||
| 63 | |||
| 64 | |||
| 65 | } |