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.

FetchAllPlans::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 14
ccs 6
cts 6
cp 1
crap 1
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
4
namespace Gbowo\Adapter\Paystack\Plugin;
5
6
use Gbowo\Adapter\Paystack\Traits\VerifyHttpStatusResponseCode;
7
use Gbowo\Plugin\AbstractFetchAllPlans;
8
use function Gbowo\toQueryParams;
9
use Psr\Http\Message\ResponseInterface;
10
use function GuzzleHttp\json_decode;
11
12
class FetchAllPlans extends AbstractFetchAllPlans
13
{
14
    use VerifyHttpStatusResponseCode;
15
16
    const FETCH_ALL_PLANS_RELATIVE_LINK = "/plan";
17
18
    /**
19
     * @var \Gbowo\Contract\Adapter\AdapterInterface
20
     */
21
    protected $adapter;
22
23
    protected $baseUrl;
24
25 2
    public function __construct(string $baseUrl)
26
    {
27 2
        $this->baseUrl = $baseUrl;
28 2
    }
29
30
    /**
31
     * @param array $args
32
     * @return mixed
33
     * @throws \Gbowo\Exception\InvalidHttpResponseException if the HTTP response status code is not 200
34
     */
35 2
    public function handle(array $args = [])
36
    {
37 2
        $params = toQueryParams($args);
38
39
        /**
40
         * @var ResponseInterface $response
41
         */
42 2
        $response = $this->adapter->getHttpClient()
43 2
            ->get($this->baseUrl . self::FETCH_ALL_PLANS_RELATIVE_LINK . $params);
44
45 2
        $this->verifyResponse($response);
46
47 1
        return json_decode($response->getBody(), true)['data'];
48
    }
49
}
50