Passed
Pull Request — main (#5)
by Chema
02:17
created

LnBitsBackendConfig   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 28
ccs 0
cts 12
cp 0
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 6 1
A setApiKey() 0 4 1
A getBackendName() 0 3 1
A setApiEndpoint() 0 4 1
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
    public function jsonSerialize(): array
30
    {
31
        return [
32
            // lnbits endpoint : protocol://host:port
33
            'api_endpoint' => $this->apiEndpoint,
34
            'api_key' => $this->apiKey,
35
        ];
36
    }
37
}
38