Completed
Push — master ( a6a8a1...a2d76b )
by Fabian
06:14
created

TradesResponse::manualMapping()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 8
Ratio 80 %

Code Coverage

Tests 6
CRAP Score 3.1406

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 3
nop 1
dl 8
loc 10
ccs 6
cts 8
cp 0.75
crap 3.1406
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace HanischIt\KrakenApi\Call\Trades;
4
5
use HanischIt\KrakenApi\Call\TradesHistory\Model\TradeModel;
6
use HanischIt\KrakenApi\Model\ResponseInterface;
7
8
/**
9
 * Class TradesResponse
10
 * @package HanischIt\KrakenApi\Call\Trades
11
 */
12
class TradesResponse implements ResponseInterface
13
{
14
    /**
15
     * @var \HanischIt\KrakenApi\Call\TradesHistory\Model\TradeModel[]
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
            if (!isset($trade["closing"])) {
26
                $trade["closing"] = null;
27
            }
28
            
29 1
            $this->trades[] = new TradeModel($trade["ordertxid"], $trade["pair"], $trade["time"], $trade["type"],
30 1
                $trade["ordertype"], $trade["price"], $trade["cost"], $trade["fee"], $trade["vol"], $trade["margin"],
31 1
                $trade["misc"], $trade["closing"]);
32 1
        }
33 1
    }
34
35
    /**
36
     * @return TradeModel[]
37
     */
38 1
    public function getTrades()
39
    {
40 1
        return $this->trades;
41
    }
42
43
44
}
45