Passed
Push — main ( 756af1...e120fa )
by Chema
03:55 queued 01:19
created

LnBitsBackendConfig::getBackendName()   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 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
ccs 2
cts 2
cp 1
crap 1
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 1
    public function setApiEndpoint(string $apiEndpoint): self
13
    {
14 1
        $this->apiEndpoint = rtrim($apiEndpoint, '/');
15 1
        return $this;
16
    }
17
18 1
    public function setApiKey(string $apiKey): self
19
    {
20 1
        $this->apiKey = $apiKey;
21 1
        return $this;
22
    }
23
24
    /**
25
     * @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...
26
     *     api_endpoint: string,
27
     *     api_key: string
28
     * }
29
     */
30 1
    public function jsonSerialize(): array
31
    {
32 1
        return [
33 1
            'api_endpoint' => $this->apiEndpoint,
34 1
            'api_key' => $this->apiKey,
35 1
        ];
36
    }
37
}
38