Passed
Push — master ( 80a2af...b754d5 )
by Fabian
51s
created

SpreadDataResponse::manualMapping()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 4

Importance

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