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

TradesHistoryRequest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getRequestData() 0 15 3
A getResponseClassName() 0 3 1
A getVisibility() 0 3 1
A __construct() 0 7 1
A getMethod() 0 3 1
1
<?php
2
3
namespace HanischIt\KrakenApi\Call\TradesHistory;
4
5
use HanischIt\KrakenApi\Enum\VisibilityEnum;
6
use HanischIt\KrakenApi\Model\RequestInterface;
7
8
/**
9
 * Class TradesHistoryRequest
10
 * @package HanischIt\KrakenApi\Call\TradesHistory
11
 */
12
class TradesHistoryRequest implements RequestInterface
13
{
14
    /**
15
     * @var string
16
     */
17
    private $type;
18
19
    /**
20
     * @var bool
21
     */
22
    private $trades = false;
23
    /**
24
     * @var string
25
     */
26
    private $start;
27
    /**
28
     * @var string
29
     */
30
    private $end;
31
    /**
32
     * @var int
33
     */
34
    private $ofs = 0;
35
36
    /**
37
     * TradesHistoryRequest constructor.
38
     * @param string $type
39
     * @param bool $trades
40
     * @param string $start
41
     * @param string $end
42
     * @param int $ofs
43
     */
44 2
    public function __construct($type, $trades = false, $start = null, $end = null, $ofs = null)
45
    {
46 2
        $this->type = $type;
47 2
        $this->trades = $trades;
48 2
        $this->start = $start;
49 2
        $this->end = $end;
50 2
        $this->ofs = $ofs;
51 2
    }
52
53
54
    /**
55
     * Returns the api request name
56
     *
57
     * @return string
58
     */
59 1
    public function getMethod()
60
    {
61 1
        return 'TradesHistory';
62
    }
63
64
    /**
65
     * @return string
66
     */
67 1
    public function getVisibility()
68
    {
69 1
        return VisibilityEnum::VISIBILITY_PRIVATE;
70
    }
71
72
    /**
73
     * @return array
74
     */
75 1
    public function getRequestData()
76
    {
77 1
        $ret = [];
78 1
        $ret["type"] = $this->type;
79 1
        $ret["trades"] = $this->trades;
80 1
        if ($this->start) {
81 1
            $ret["start"] = $this->start;
82 1
        }
83
84 1
        if ($this->end) {
85 1
            $ret["end"] = $this->end;
86 1
        }
87
88 1
        $ret["ofs"] = $this->ofs;
89 1
        return $ret;
90
    }
91
92
    /**
93
     * @return string
94
     */
95 1
    public function getResponseClassName()
96
    {
97 1
        return TradesHistoryResponse::class;
98
    }
99
}
100