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

OrdersInfoRequest::getMethod()   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\Call\OrdersInfo;
4
5
use HanischIt\KrakenApi\Enum\VisibilityEnum;
6
use HanischIt\KrakenApi\Model\RequestInterface;
7
8
/**
9
 * Class OrdersInfoRequest
10
 * @package HanischIt\KrakenApi\Call\OrdersInfo
11
 */
12
class OrdersInfoRequest implements RequestInterface
13
{
14
    /**
15
     * @var bool
16
     */
17
    private $trades;
18
    /**
19
     * @var string|null
20
     */
21
    private $userref;
22
    /**
23
     * @var string
24
     */
25
    private $txids;
26
27
    /**
28
     * OrdersInfoRequest constructor.
29
     * @param bool $trades
30
     * @param null|string $userref
31
     * @param null|string[] $txids
32
     */
33 2
    public function __construct(array $txids, $trades = false, $userref = null)
34
    {
35 2
        $this->trades = $trades;
36 2
        if (null !== $userref) {
37 1
            $this->userref = $userref;
38 1
        }
39
40 2
        $this->txids = implode(",", $txids);
41 2
    }
42
43
44
    /**
45
     * Returns the api request name
46
     *
47
     * @return string
48
     */
49 1
    public function getMethod()
50
    {
51 1
        return 'QueryOrders';
52
    }
53
54
    /**
55
     * @return string
56
     */
57 1
    public function getVisibility()
58
    {
59 1
        return VisibilityEnum::VISIBILITY_PRIVATE;
60
    }
61
62
    /**
63
     * @return array
64
     */
65 1
    public function getRequestData()
66
    {
67 1
        $ret = [];
68 1
        $ret["trades"] = $this->trades;
69 1
        if (null !== $this->userref) {
70 1
            $ret["userref"] = $this->userref;
71 1
        }
72 1
        if (null !== $this->txids) {
73 1
            $ret["txid"] = $this->txids;
74 1
        }
75 1
        return $ret;
76
    }
77
78
    /**
79
     * @return string
80
     */
81 1
    public function getResponseClassName()
82
    {
83 1
        return OrdersInfoResponse::class;
84
    }
85
}
86