Passed
Push — main ( 3b8d3e...36fa87 )
by Chema
01:12 queued 13s
created

LnBitsBackendConfig::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpLightning\Config\Backend;
6
7
final class LnBitsBackendConfig implements BackendConfigInterface
8
{
9
    private string $apiEndpoint = 'http://localhost:5000';
10
    private string $apiKey = '';
11
12
    public function setApiEndpoint(string $apiEndpoint): self
13
    {
14
        $this->apiEndpoint = $apiEndpoint;
15
        return $this;
16
    }
17
18
    public function setApiKey(string $apiKey): self
19
    {
20
        $this->apiKey = $apiKey;
21
        return $this;
22
    }
23
24
    public function getBackendName(): string
25
    {
26
        return 'lnbits';
27
    }
28
29
    /**
30
     * @return array{
0 ignored issues
show
Documentation Bug introduced by
The doc comment array{ at position 2 could not be parsed: the token is null at position 2.
Loading history...
31
     *     api_endpoint: string,
32
     *     api_key: string
33
     * }
34
     */
35
    public function jsonSerialize(): array
36
    {
37
        return [
38
            // lnbits endpoint : protocol://host:port
39
            'api_endpoint' => $this->apiEndpoint,
40
            'api_key' => $this->apiKey,
41
        ];
42
    }
43
}
44