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

OpenOrdersAbstractRequest::getRequestData()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 9
ccs 7
cts 7
cp 1
crap 2
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace HanischIt\KrakenApi\Model\OpenOrders;
4
5
use HanischIt\KrakenApi\Enum\VisibilityEnum;
6
use HanischIt\KrakenApi\Model\AbstractRequest;
7
8
/**
9
 * Class OpenOrdersAbstractRequest
10
 *
11
 * @package HanischIt\KrakenApi\Model\OpenOrders
12
 */
13
class OpenOrdersAbstractRequest extends AbstractRequest
14
{
15
    /**
16
     * @var bool
17
     */
18
    private $trades;
19
    /**
20
     * @var string|null
21
     */
22
    private $userref;
23
24
    /**
25
     * OrderBookAbstractRequest constructor.
26
     *
27
     * @param bool $trades
28
     * @param null $userref
29
     */
30 3
    public function __construct($trades = false, $userref = null)
31
    {
32 3
        $this->trades = $trades;
33 3
        $this->userref = $userref;
34 3
    }
35
36
    /**
37
     * Returns the api request name
38
     *
39
     * @return string
40
     */
41 2
    public function getMethod()
42
    {
43 2
        return 'OpenOrders';
44
    }
45
46
    /**
47
     * @return string
48
     */
49 2
    public function getVisibility()
50
    {
51 2
        return VisibilityEnum::VISIBILITY_PRIVATE;
52
    }
53
54
    /**
55
     * @return array
56
     */
57 2
    public function getRequestData()
58
    {
59 2
        $arr = [];
60 2
        $arr["trades"] = $this->trades;
61 2
        if (null !== $this->userref) {
62 1
            $arr["userref"] = $this->userref;
63 1
        }
64
65 2
        return $arr;
66
    }
67
68
    /**
69
     * @return string
70
     */
71 2
    public function getResponseClassName()
72
    {
73 2
        return OpenOrdersResponse::class;
74
    }
75
}
76