Completed
Push — master ( 65b971...326999 )
by Fabian
02:18
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 1
Bugs 0 Features 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 1
b 0
f 0
1
<?php
2
3
namespace HanischIt\KrakenApi\Model\TradeVolume;
4
5
use HanischIt\KrakenApi\Model\ResponseInterface;
6
7
/**
8
 * Class TradeVolumeResponse
9
 * @package HanischIt\KrakenApi\Model\TradeVolume
10
 */
11
class TradeVolumeResponse implements ResponseInterface
12
{
13
    /**
14
     * @var string
15
     */
16
    private $currency;
17
    /**
18
     * @var float
19
     */
20
    private $volume;
21
    /**
22
     * @var FeeModel[]
23
     */
24
    private $fees = [];
25
    /**
26
     * @var FeeModel[]
27
     */
28
    private $feesMaker = [];
29
30
    /**
31
     * @param array $result
32
     */
33 1
    public function manualMapping($result)
34
    {
35 1
        $this->currency = $result["currency"];
36 1
        $this->volume = $result["volume"];
37
38
39 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...
40 1
            foreach ($result["fees"] as $fee) {
41 1
                $this->fees[] = new FeeModel(
42 1
                    $fee["fee"],
43 1
                    $fee["minfee"],
44 1
                    $fee["maxfee"],
45 1
                    $fee["nextfee"],
46 1
                    $fee["nextvolume"],
47 1
                    $fee["tiervolume"]
48 1
                );
49 1
            }
50 1
        }
51
52 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...
53 1
            foreach ($result["fees_maker"] as $fee) {
54 1
                $this->feesMaker[] = new FeeModel(
55 1
                    $fee["fee"],
56 1
                    $fee["minfee"],
57 1
                    $fee["maxfee"],
58 1
                    $fee["nextfee"],
59 1
                    $fee["nextvolume"],
60 1
                    $fee["tiervolume"]
61 1
                );
62 1
            }
63 1
        }
64 1
    }
65
66
    /**
67
     * @return string
68
     */
69 1
    public function getCurrency()
70
    {
71 1
        return $this->currency;
72
    }
73
74
    /**
75
     * @return float
76
     */
77 1
    public function getVolume()
78
    {
79 1
        return $this->volume;
80
    }
81
82
    /**
83
     * @return FeeModel[]
84
     */
85 1
    public function getFees()
86
    {
87 1
        return $this->fees;
88
    }
89
90
    /**
91
     * @return FeeModel[]
92
     */
93 1
    public function getFeesMaker()
94
    {
95 1
        return $this->feesMaker;
96
    }
97
98
99
}
100