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.

AbstractRequest::makeRequest()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Monobank\Request;
6
7
use GuzzleHttp\Client;
8
use GuzzleHttp\ClientInterface;
9
use GuzzleHttp\Exception\RequestException;
10
use GuzzleHttp\Psr7\Request;
11
use Monobank\Exception\Factory;
12
13
abstract class AbstractRequest
14
{
15
    /**
16
     * @var ClientInterface|Client
17
     */
18
    protected $client;
19
20
    public function __construct(Client $client)
21
    {
22
        $this->client = $client;
23
    }
24
25
    /**
26
     * @throws \Monobank\Exception\InvalidAccountException
27
     * @throws \Monobank\Exception\InternalErrorException
28
     * @throws \Monobank\Exception\MonobankException
29
     * @throws \Monobank\Exception\TooManyRequestsException
30
     * @throws \Monobank\Exception\UnknownTokenException
31
     */
32
    protected function makeRequest(Request $request): array
33
    {
34
        try {
35
            $response = $this->client->send($request);
36
        } catch (RequestException $exception) {
37
            throw Factory::createFromResponse($exception->getResponse());
38
        }
39
40
        return json_decode($response->getBody()->getContents(), true);
41
    }
42
}
43