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

TradeVolumeResponse::manualMapping()   B

Complexity

Conditions 5
Paths 6

Size

Total Lines 28
Code Lines 20

Duplication

Lines 21
Ratio 75 %

Code Coverage

Tests 24
CRAP Score 5

Importance

Changes 0
Metric Value
cc 5
eloc 20
nc 6
nop 1
dl 21
loc 28
ccs 24
cts 24
cp 1
crap 5
rs 8.439
c 0
b 0
f 0
1
<?php
2
3
namespace HanischIt\KrakenApi\Call\TradeVolume;
4
5
use HanischIt\KrakenApi\Call\TradeVolume\Model\FeeModel;
6
use HanischIt\KrakenApi\Model\ResponseInterface;
7
8
/**
9
 * Class TradeVolumeResponse
10
 * @package HanischIt\KrakenApi\Call\TradeVolume
11
 */
12
class TradeVolumeResponse implements ResponseInterface
13
{
14
    /**
15
     * @var string
16
     */
17
    private $currency;
18
    /**
19
     * @var float
20
     */
21
    private $volume;
22
    /**
23
     * @var FeeModel[]
24
     */
25
    private $fees = [];
26
    /**
27
     * @var FeeModel[]
28
     */
29
    private $feesMaker = [];
30
31
    /**
32
     * @param array $result
33
     */
34 1
    public function manualMapping($result)
35
    {
36 1
        $this->currency = $result["currency"];
37 1
        $this->volume = $result["volume"];
38
39
40 1 View Code Duplication
        if (isset($result["fees"])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
41 1
            foreach ($result["fees"] as $fee) {
42 1
                $this->fees[] = new FeeModel(
43 1
                    $fee["fee"],
44 1
                    $fee["minfee"],
45 1
                    $fee["maxfee"],
46 1
                    $fee["nextfee"],
47 1
                    $fee["nextvolume"],
48 1
                    $fee["tiervolume"]
49 1
                );
50 1
            }
51 1
        }
52
53 1 View Code Duplication
        if (isset($result["fees_maker"])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54 1
            foreach ($result["fees_maker"] as $fee) {
55 1
                $this->feesMaker[] = new FeeModel(
56 1
                    $fee["fee"],
57 1
                    $fee["minfee"],
58 1
                    $fee["maxfee"],
59 1
                    $fee["nextfee"],
60 1
                    $fee["nextvolume"],
61 1
                    $fee["tiervolume"]
62 1
                );
63 1
            }
64 1
        }
65 1
    }
66
67
    /**
68
     * @return string
69
     */
70 1
    public function getCurrency()
71
    {
72 1
        return $this->currency;
73
    }
74
75
    /**
76
     * @return float
77
     */
78 1
    public function getVolume()
79
    {
80 1
        return $this->volume;
81
    }
82
83
    /**
84
     * @return FeeModel[]
85
     */
86 1
    public function getFees()
87
    {
88 1
        return $this->fees;
89
    }
90
91
    /**
92
     * @return FeeModel[]
93
     */
94 1
    public function getFeesMaker()
95
    {
96 1
        return $this->feesMaker;
97
    }
98
99
100
}
101