Completed
Push — master ( 65b971...326999 )
by Fabian
02:18
created

TradeVolumeRequest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 63
Duplicated Lines 100 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 63
loc 63
ccs 19
cts 19
cp 1
rs 10
c 1
b 0
f 0
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getResponseClassName() 3 3 1
A getRequestData() 10 10 3
A getVisibility() 3 3 1
A getMethod() 3 3 1
A __construct() 4 4 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\TradeVolume;
4
5
use HanischIt\KrakenApi\Enum\VisibilityEnum;
6
use HanischIt\KrakenApi\Model\RequestInterface;
7
8
/**
9
 * Class TradeVolumeRequest
10
 * @package HanischIt\KrakenApi\Model\TradeVolume
11
 */
12 View Code Duplication
class TradeVolumeRequest implements RequestInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in 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...
13
{
14
15
    /**
16
     * @var string
17
     */
18
    private $pair;
19
    /**
20
     * @var bool
21
     */
22
    private $feeInfo;
23
24
    /**
25
     * TradeVolumeRequest constructor.
26
     * @param string $pair
27
     * @param bool $feeInfo
28
     */
29 2
    public function __construct($pair = null, $feeInfo = null)
30
    {
31 2
        $this->pair = $pair;
32 2
        $this->feeInfo = $feeInfo;
33 2
    }
34
35
36
    /**
37
     * Returns the api request name
38
     *
39
     * @return string
40
     */
41 1
    public function getMethod()
42
    {
43 1
        return 'TradeVolume';
44
    }
45
46
    /**
47
     * @return string
48
     */
49 1
    public function getVisibility()
50
    {
51 1
        return VisibilityEnum::VISIBILITY_PRIVATE;
52
    }
53
54
    /**
55
     * @return array
56
     */
57 1
    public function getRequestData()
58
    {
59 1
        $ret = [];
60 1
        if ($this->pair) {
61 1
            $ret["pair"] = $this->pair;
62 1
        }
63 1
        if ($this->feeInfo) {
64 1
            $ret["fee-info"] = $this->feeInfo;
65 1
        }
66 1
        return $ret;
67
    }
68
69
    /**
70
     * @return string
71
     */
72 1
    public function getResponseClassName()
73
    {
74 1
        return TradeVolumeResponse::class;
75
    }
76
}
77