| Total Complexity | 15 |
| Total Lines | 173 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class KlineResponse extends ResponseEntity implements IKlineDto |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var \DateTime $start |
||
| 13 | */ |
||
| 14 | private \DateTime $start; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var float $open |
||
| 18 | */ |
||
| 19 | private float $open; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var float $high |
||
| 23 | */ |
||
| 24 | private float $high; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var float $low |
||
| 28 | */ |
||
| 29 | private float $low; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var float $close |
||
| 33 | */ |
||
| 34 | private float $close; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @var float $volume |
||
| 38 | */ |
||
| 39 | private float $volume; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @var float $turnover |
||
| 43 | */ |
||
| 44 | private float $turnover; |
||
| 45 | |||
| 46 | public function __construct(array $data) |
||
| 47 | { |
||
| 48 | $this |
||
| 49 | ->setStart($data[0]) |
||
| 50 | ->setOpen($data[1]) |
||
| 51 | ->setHigh($data[2]) |
||
| 52 | ->setLow($data[3]) |
||
| 53 | ->setClose($data[4]) |
||
| 54 | ->setVolume($data[5]) |
||
| 55 | ->setTurnover($data[6]); |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @param int $start |
||
| 60 | * @return KlineResponse |
||
| 61 | */ |
||
| 62 | public function setStart(int $start): self |
||
| 63 | { |
||
| 64 | $this->start = DateTimeHelper::makeFromTimestamp($start); |
||
| 65 | return $this; |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @return \DateTime |
||
| 70 | */ |
||
| 71 | public function getStart(): \DateTime |
||
| 72 | { |
||
| 73 | return $this->start; |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @param float $open |
||
| 78 | * @return $this |
||
| 79 | */ |
||
| 80 | private function setOpen(float $open): self |
||
| 81 | { |
||
| 82 | $this->open = $open; |
||
| 83 | return $this; |
||
| 84 | } |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @return float |
||
| 88 | */ |
||
| 89 | public function getOpen(): float |
||
| 90 | { |
||
| 91 | return $this->open; |
||
| 92 | } |
||
| 93 | |||
| 94 | /** |
||
| 95 | * @param float $high |
||
| 96 | * @return $this |
||
| 97 | */ |
||
| 98 | private function setHigh(float $high): self |
||
| 99 | { |
||
| 100 | $this->high = $high; |
||
| 101 | return $this; |
||
| 102 | } |
||
| 103 | |||
| 104 | /** |
||
| 105 | * @return float |
||
| 106 | */ |
||
| 107 | public function getHigh(): float |
||
| 108 | { |
||
| 109 | return $this->high; |
||
| 110 | } |
||
| 111 | |||
| 112 | /** |
||
| 113 | * @param float $low |
||
| 114 | * @return $this |
||
| 115 | */ |
||
| 116 | private function setLow(float $low): self |
||
| 117 | { |
||
| 118 | $this->low = $low; |
||
| 119 | return $this; |
||
| 120 | } |
||
| 121 | |||
| 122 | /** |
||
| 123 | * @return float |
||
| 124 | */ |
||
| 125 | public function getLow(): float |
||
| 126 | { |
||
| 127 | return $this->low; |
||
| 128 | } |
||
| 129 | |||
| 130 | /** |
||
| 131 | * @param float $close |
||
| 132 | * @return $this |
||
| 133 | */ |
||
| 134 | private function setClose(float $close): self |
||
| 135 | { |
||
| 136 | $this->close = $close; |
||
| 137 | return $this; |
||
| 138 | } |
||
| 139 | |||
| 140 | /** |
||
| 141 | * @return float |
||
| 142 | */ |
||
| 143 | public function getClose(): float |
||
| 144 | { |
||
| 145 | return $this->close; |
||
| 146 | } |
||
| 147 | |||
| 148 | /** |
||
| 149 | * @param float $volume |
||
| 150 | * @return KlineResponse |
||
| 151 | */ |
||
| 152 | private function setVolume(float $volume): self |
||
| 156 | } |
||
| 157 | |||
| 158 | /** |
||
| 159 | * @return float |
||
| 160 | */ |
||
| 161 | public function getVolume(): float |
||
| 162 | { |
||
| 163 | return $this->volume; |
||
| 164 | } |
||
| 165 | |||
| 166 | /** |
||
| 167 | * @param float $turnover |
||
| 168 | * @return KlineResponse |
||
| 169 | */ |
||
| 170 | public function setTurnover(float $turnover): self |
||
| 171 | { |
||
| 172 | $this->turnover = $turnover; |
||
| 173 | return $this; |
||
| 174 | } |
||
| 175 | |||
| 176 | /** |
||
| 177 | * @return float |
||
| 178 | */ |
||
| 179 | public function getTurnover(): float |
||
| 182 | } |
||
| 183 | } |