Completed
Push — master ( 14b1fb...866668 )
by Fabian
03:05
created

SpreadDataResponse   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 41
ccs 14
cts 14
cp 1
rs 10
c 1
b 0
f 0
wmc 6

3 Methods

Rating   Name   Duplication   Size   Complexity  
A manualMapping() 0 9 4
A getSpreads() 0 3 1
A getLast() 0 3 1
1
<?php
2
3
namespace HanischIt\KrakenApi\Model\SpreadData;
4
5
/**
6
 * Class SpreadDataResponse
7
 * @package HanischIt\KrakenApi\Model\SpreadData
8
 */
9
class SpreadDataResponse implements SpreadDataResponseInterface
10
{
11
    /**
12
     * @var int
13
     */
14
    private $last;
15
    /**
16
     * @var SpreadDataModel[]
17
     */
18
    private $spreads;
19
20
    /**
21
     * @param array $result
22
     */
23 3
    public function manualMapping($result)
24
    {
25 3
        $this->last = $result["last"];
26 3
        foreach ($result as $assetPair => $assetData) {
27 3
            if ($assetPair == "last") {
28 3
                continue;
29
            }
30 3
            foreach ($assetData as $data) {
31 3
                $this->spreads[] = new SpreadDataModel($data[0], $data[1], $data[2]);
32 3
            }
33 3
        }
34 3
    }
35
36
    /**
37
     * @return int
38
     */
39 1
    public function getLast()
40
    {
41 1
        return $this->last;
42
    }
43
44
    /**
45
     * @return SpreadDataModel[]
46
     */
47 1
    public function getSpreads()
48
    {
49 1
        return $this->spreads;
50
    }
51
}
52