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

OpenOrdersAbstractRequest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 61
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getResponseClassName() 0 3 1
A getMethod() 0 3 1
A __construct() 0 4 1
A getRequestData() 0 9 2
A getVisibility() 0 3 1
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