Completed
Push — master ( d83768...66ea7e )
by Fabian
02:05
created

SpreadDataResponse::getSpreads()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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