Completed
Push — master ( 371a9b...ee3472 )
by Fabian
02:23
created

TradesResponse   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 13.04 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 3
loc 23
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A manualMapping() 2 4 2
A getTrades() 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\Model\Trades;
4
5
use HanischIt\KrakenApi\Model\ResponseInterface;
6
use HanischIt\KrakenApi\Model\TradesHistory\Trade;
7
8
/**
9
 * Class TradesResponse
10
 * @package HanischIt\KrakenApi\Model\Trades
11
 */
12
class TradesResponse implements ResponseInterface
13
{
14
    /**
15
     * @var Trade[]
16
     */
17
    private $trades;
18
19
    /**
20
     * @param array $result
21
     */
22 1
    public function manualMapping($result)
23
    {
24 1 View Code Duplication
        foreach ($result as $txId => $trade) {
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...
25 1
            $this->trades[] = new Trade($trade["ordertxid"], $trade["pair"], $trade["time"], $trade["type"], $trade["ordertype"], $trade["price"], $trade["cost"], $trade["fee"], $trade["vol"], $trade["margin"], $trade["misc"], $trade["closing"]);
26 1
        }
27 1
    }
28
29
    /**
30
     * @return Trade[]
31
     */
32 1
    public function getTrades()
33
    {
34 1
        return $this->trades;
35
    }
36
37
38
}
39