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

QueryLedgersResponse   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 39.39 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 13
loc 33
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getLedgerInfos() 0 3 1
A manualMapping() 11 13 2

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\QueryLedgers;
4
5
use HanischIt\KrakenApi\Call\Shared\Model\LedgerInfoModel;
6
use HanischIt\KrakenApi\Model\ResponseInterface;
7
8
/**
9
 * Class QueryLedgersResponse
10
 * @package HanischIt\KrakenApi\Call\QueryLedgers
11
 */
12
class QueryLedgersResponse implements ResponseInterface
13
{
14
    /**
15
     * @var LedgerInfoModel[]
16
     */
17
    private $ledgerInfos;
18
19
    /**
20
     * @param array $result
21
     */
22 1
    public function manualMapping($result)
23
    {
24 1 View Code Duplication
        foreach ($result as $ledgerId => $ledger) {
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->ledgerInfos[] = new LedgerInfoModel(
26 1
                $ledgerId,
27 1
                $ledger['refid'],
28 1
                $ledger['time'],
29 1
                $ledger['type'],
30 1
                $ledger['aclass'],
31 1
                $ledger['asset'],
32 1
                $ledger['amount'],
33 1
                $ledger['fee'],
34 1
                $ledger['balance']
35 1
            );
36 1
        }
37 1
    }
38
39
    /**
40
     * @return LedgerInfoModel[]
41
     */
42 1
    public function getLedgerInfos()
43
    {
44 1
        return $this->ledgerInfos;
45
    }
46
47
48
}
49