Passed
Push — master ( 37b5d9...f0b58d )
by Fabian
02:07
created

ClosedOrdersRequest   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 97
ccs 33
cts 33
cp 1
rs 10
wmc 10

5 Methods

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