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.
Completed
Push — master ( 92425a...bdb42f )
by Cees-Jan
13s
created

LogglyLogger::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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