Completed
Push — master ( 3ad417...37b5d9 )
by Fabian
02:10
created

ClosedOrdersAbstractRequest::getVisibility()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace HanischIt\KrakenApi\Model\ClosedOrders;
4
5
use HanischIt\KrakenApi\Enum\VisibilityEnum;
6
use HanischIt\KrakenApi\Model\AbstractRequest;
7
8
/**
9
 * Class ClosedOrdersAbstractRequest
10
 *
11
 * @package HanischIt\KrakenApi\Model\ClosedOrders
12
 */
13
class ClosedOrdersAbstractRequest extends AbstractRequest
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
     * OrderBookAbstractRequest 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