HttpApi   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A postRequestInvoice() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpLightning\Invoice\Infrastructure\Http;
6
7
use PhpLightning\Invoice\Domain\Http\HttpApiInterface;
8
use Symfony\Component\HttpClient\HttpClient;
9
10
final class HttpApi implements HttpApiInterface
11
{
12
    public function postRequestInvoice(string $uri, string $body, array $headers = []): ?array
13
    {
14
        $response = HttpClient::create()
15
            ->request('POST', $uri, [
16
                'headers' => $headers,
17
                'body' => $body,
18
            ]);
19
20
        return json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR);
21
    }
22
}
23