CreateWalletAddressRequest::getHeaders()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Package: PHP Bitaps API
7
 *
8
 * (c) Eldar Gazaliev <[email protected]>
9
 *
10
 *  Link: <https://github.com/MyZik>
11
 *
12
 * For the full copyright and license information, please view the LICENSE file
13
 * that was distributed with this source code.
14
 */
15
16
namespace Bitaps\WalletAPI\Request;
17
18
class CreateWalletAddressRequest implements RequestInterface
19
{
20
    /**
21
     * Wallet ID
22
     *
23
     * @var string
24
     */
25
    private string $walletId;
26
27
    /**
28
     * Link to the payment notification handler
29
     *
30
     * @var string|null
31
     */
32
    private ?string $callbackLink;
33
34
    /**
35
     * Number of confirmations for payment notification, default 3
36
     *
37
     * @var int|null
38
     */
39
    private ?int $confirmations;
40
41
    /**
42
     * @param string      $walletId
43
     * @param string|null $callbackLink
44
     * @param int         $confirmations
45
     */
46
    public function __construct(string $walletId, string $callbackLink = null, int $confirmations = 3)
47
    {
48
        $this->walletId = $walletId;
49
        $this->callbackLink = $callbackLink;
50
        $this->confirmations = $confirmations;
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getPathParams(): string
57
    {
58
        return '/create/wallet/payment/address';
59
    }
60
61
    /**
62
     * @return array
63
     */
64
    public function getHeaders(): array
65
    {
66
        return [];
67
    }
68
69
    /**
70
     * @return array
71
     */
72
    public function getBody(): array
73
    {
74
        return [
75
            'wallet_id' => $this->walletId,
76
            $this->callbackLink === null ?: 'callback_link' => $this->callbackLink,
77
            'confirmations' => $this->confirmations
78
        ];
79
    }
80
}
81