Completed
Push — master ( 39a0bd...0a53a0 )
by Fabian
02:26
created

TradableAssetPairsResponse::getTradableAssets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace HanischIt\KrakenApi\Call\TradableAssetPairs;
4
5
use HanischIt\KrakenApi\Call\TradableAssetPairs\Model\AssetPairModel;
6
use HanischIt\KrakenApi\Call\TradableAssetPairs\Model\FeeModel;
7
use HanischIt\KrakenApi\Model\ResponseInterface;
8
9
/**
10
 * Class TradableAssetPairsResponse
11
 * @package HanischIt\KrakenApi\Call\TradableAssetPairs
12
 */
13
class TradableAssetPairsResponse implements ResponseInterface
14
{
15
    /**
16
     * @var AssetPairModel[]
17
     */
18
    private $tradableAssets;
19
20
    /**
21
     * @param array $arr
22
     */
23 1
    public function manualMapping(array $arr)
24
    {
25 1
        foreach ($arr as $assetPair => $data) {
26 1
            $fees = [];
27 1
            foreach ($data["fees"] as $feeData) {
28 1
                $fees[] = new FeeModel($feeData[0], $feeData[1]);
29 1
            }
30 1
            $feesMaker = [];
31 1
            foreach ($data["fees_maker"] as $feeData) {
32 1
                $feesMaker[] = new FeeModel($feeData[0], $feeData[1]);
33 1
            }
34 1
            $this->tradableAssets[] = new AssetPairModel(
35 1
                $assetPair,
36 1
                $data["altname"],
37 1
                $data["aclass_base"],
38 1
                $data["base"],
39 1
                $data["aclass_quote"],
40 1
                $data["quote"],
41 1
                $data["lot"],
42 1
                $data["pair_decimals"],
43 1
                $data["lot_decimals"],
44 1
                $data["lot_multiplier"],
45 1
                $data["leverage_buy"],
46 1
                $data["leverage_sell"],
47 1
                $fees,
48 1
                $feesMaker,
49 1
                $data["fee_volume_currency"],
50 1
                $data["margin_call"],
51 1
                $data["margin_stop"]
52 1
            );
53 1
        }
54 1
    }
55
56
    /**
57
     * @return AssetPairModel[]
58
     */
59 1
    public function getTradableAssets()
60
    {
61 1
        return $this->tradableAssets;
62
    }
63
}
64