GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

LogglyLogger::createFromHttpClient()   A
last analyzed

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 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WyriHaximus\React\PSR3\Loggly;
6
7
use React\Http\Browser;
8
9
use function strlen;
10
11
final class LogglyLogger extends AbstractLogglyLogger
12
{
13
    private Browser $httpClient;
14
15
    private string $token;
16
17
    private function __construct(Browser $httpClient, string $token)
18
    {
19
        $this->httpClient = $httpClient;
20 16
        $this->token      = $token;
21
    }
22 16
23 16
    public static function create(string $token): self
24 16
    {
25
        return new self(new Browser(), $token);
26 4
    }
27
28 4
    public static function createFromHttpClient(Browser $httpClient, string $token): self
29
    {
30 4
        return new self($httpClient, $token);
31
    }
32
33 12
    /**
34
     * @psalm-suppress TooManyTemplateParams
35 12
     */
36
    protected function send(string $data): void
37
    {
38 12
        $this->httpClient->post(
39
            'https://logs-01.loggly.com/inputs/' . $this->token,
40 12
            [
41 12
                'Content-Type' => 'application/json',
42 12
                'Content-Length' => strlen($data),
43
            ],
44 12
            $data
45 12
        );
46
    }
47
}
48