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

TradeVolumeResponse   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 85
Duplicated Lines 28.24 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 24
loc 85
ccs 36
cts 36
cp 1
rs 10
c 0
b 0
f 0
wmc 9

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getVolume() 0 3 1
A getFeesMaker() 0 3 1
A getFees() 0 3 1
B manualMapping() 21 28 5
A getCurrency() 0 3 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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