Total Complexity | 4 |
Total Lines | 110 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | class WalletTransactionsRequest implements RequestInterface |
||
19 | { |
||
20 | /** |
||
21 | * Wallet ID |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | public string $walletId; |
||
26 | |||
27 | /** |
||
28 | * Nonce used for HMAC signature |
||
29 | * |
||
30 | * @var float|null |
||
31 | */ |
||
32 | public ?float $nonce; |
||
33 | |||
34 | /** |
||
35 | * HMAC signature |
||
36 | * |
||
37 | * @var string|null |
||
38 | */ |
||
39 | public ?string $signature; |
||
40 | |||
41 | /** |
||
42 | * Beginning of range in unix timestamp |
||
43 | * |
||
44 | * @var int|null |
||
45 | */ |
||
46 | private ?int $from; |
||
47 | |||
48 | /** |
||
49 | * Ending of range in unix timestamp |
||
50 | * |
||
51 | * @var int|null |
||
52 | */ |
||
53 | private ?int $to; |
||
54 | |||
55 | /** |
||
56 | * Records on page |
||
57 | * |
||
58 | * @var int|null |
||
59 | */ |
||
60 | private ?int $limit; |
||
61 | |||
62 | /** |
||
63 | * Page number |
||
64 | * |
||
65 | * @var int|null |
||
66 | */ |
||
67 | private ?int $page; |
||
68 | |||
69 | /** |
||
70 | * @param string $walletId |
||
71 | * @param float|null $nonce |
||
72 | * @param string|null $signature |
||
73 | * @param int|null $from |
||
74 | * @param int|null $to |
||
75 | * @param int|null $limit |
||
76 | * @param int|null $page |
||
77 | */ |
||
78 | public function __construct( |
||
79 | string $walletId, |
||
80 | float $nonce = null, |
||
81 | string $signature = null, |
||
82 | int $from = null, |
||
83 | int $to = null, |
||
84 | int $limit = null, |
||
85 | int $page = null |
||
86 | ) { |
||
87 | $this->walletId = $walletId; |
||
88 | $this->nonce = $nonce; |
||
89 | $this->signature = $signature; |
||
90 | $this->from = $from; |
||
91 | $this->to = $to; |
||
92 | $this->limit = $limit; |
||
93 | $this->page = $page; |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * @return string |
||
98 | */ |
||
99 | public function getPathParams(): string |
||
100 | { |
||
101 | return sprintf( |
||
102 | "/wallet/transactions/%s?from=%d&to=%d&limit=%d&page=%d", |
||
103 | $this->walletId, |
||
104 | $this->from, |
||
105 | $this->to, |
||
106 | $this->limit, |
||
107 | $this->page |
||
108 | ); |
||
109 | } |
||
110 | |||
111 | /** |
||
112 | * @return array |
||
113 | */ |
||
114 | public function getHeaders(): array |
||
115 | { |
||
116 | return [ |
||
117 | 'Access-Nonce' => $this->nonce, |
||
118 | 'Access-Signature' => $this->signature |
||
119 | ]; |
||
120 | } |
||
121 | |||
122 | /** |
||
123 | * @return array |
||
124 | */ |
||
125 | public function getBody(): array |
||
128 | } |
||
129 | } |
||
130 |