| Total Complexity | 5 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 86.67% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class TradesHistoryResponse implements ResponseInterface |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var int |
||
| 16 | */ |
||
| 17 | private $count; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var TradeModel[] |
||
| 21 | */ |
||
| 22 | private $trades; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param array $result |
||
| 26 | */ |
||
| 27 | 1 | public function manualMapping($result) |
|
| 28 | { |
||
| 29 | 1 | $this->count = $result["count"]; |
|
| 30 | 1 | foreach ($result["trades"] as $trade) { |
|
| 31 | 1 | if (!isset($trade["closing"])) { |
|
| 32 | $trade["closing"] = null; |
||
| 33 | } |
||
| 34 | 1 | $this->trades[] = new TradeModel($trade["ordertxid"], $trade["pair"], $trade["time"], $trade["type"], |
|
| 35 | 1 | $trade["ordertype"], $trade["price"], $trade["cost"], $trade["fee"], $trade["vol"], $trade["margin"], |
|
| 36 | 1 | $trade["misc"], $trade["closing"]); |
|
| 37 | 1 | } |
|
| 38 | 1 | } |
|
| 39 | |||
| 40 | /** |
||
| 41 | * @return int |
||
| 42 | */ |
||
| 43 | 1 | public function getCount() |
|
| 44 | { |
||
| 45 | 1 | return $this->count; |
|
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @return TradeModel[] |
||
| 50 | */ |
||
| 51 | 1 | public function getTrades() |
|
| 54 | } |
||
| 55 | |||
| 56 | |||
| 58 |