Completed
Push — master ( baee16...d38af1 )
by Fabian
02:13
created

OHLCDataResponse::getLast()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace HanischIt\KrakenApi\Model\OHLCData;
4
5
use HanischIt\KrakenApi\Model\ResponseInterface;
6
7
/**
8
 * Class ServerTimeResponse
9
 *
10
 * @package HanischIt\KrakenApi\Model\ServerTime
11
 */
12
class OHLCDataResponse implements ResponseInterface
13
{
14
15
    /**
16
     *
17
     * @var int
18
     */
19
    private $last;
20
21
    /**
22
     * @var OHLCDataModel[]
23
     */
24
    private $ohlcDataModels;
25
26
    /**
27
     * @param array $data
28
     */
29
    public function manualMapping($data)
30
    {
31
        $this->last = $data["last"];
32
33
        foreach ($data as $assetPair => $assetDataArr) {
34
            if ($assetPair == "last") {
35
                continue;
36
            }
37
38
            foreach ($assetDataArr as $assetData) {
39
                $this->ohlcDataModels[] = new OHLCDataModel($assetData[0], $assetData[1], $assetData[2], $assetData[3], $assetData[4], $assetData[5], $assetData[6], $assetData[7]);
40
            }
41
        }
42
    }
43
44
    /**
45
     * @return int
46
     */
47
    public function getLast()
48
    {
49
        return $this->last;
50
    }
51
52
    /**
53
     * @return OHLCDataModel[]
54
     */
55
    public function getOhlcDataModels()
56
    {
57
        return $this->ohlcDataModels;
58
    }
59
}
60