Passed
Push — master ( f0b58d...371a9b )
by Fabian
02:51
created

TradesHistoryResponse::manualMapping()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 2
rs 9.4285
1
<?php
2
3
namespace HanischIt\KrakenApi\Model\TradesHistory;
4
5
use HanischIt\KrakenApi\Model\ResponseInterface;
6
7
/**
8
 * Class TradesHistoryResponse
9
 * @package HanischIt\KrakenApi\Model\TradesHistory
10
 */
11
class TradesHistoryResponse implements ResponseInterface
12
{
13
    /**
14
     * @var int
15
     */
16
    private $count;
17
18
    /**
19
     * @var Trade[]
20
     */
21
    private $trades;
22
23
    /**
24
     * @param array $result
25
     */
26 1
    public function manualMapping($result)
27
    {
28 1
        $this->count = $result["count"];
29 1
        foreach ($result["trades"] as $trade) {
30 1
            $this->trades[] = new Trade($trade["ordertxid"], $trade["pair"], $trade["time"], $trade["type"], $trade["ordertype"], $trade["price"], $trade["cost"], $trade["fee"], $trade["vol"], $trade["margin"], $trade["misc"], $trade["closing"]);
31 1
        }
32 1
    }
33
34
    /**
35
     * @return int
36
     */
37 1
    public function getCount()
38
    {
39 1
        return $this->count;
40
    }
41
42
    /**
43
     * @return Trade[]
44
     */
45 1
    public function getTrades()
46
    {
47 1
        return $this->trades;
48
    }
49
50
51
}
52