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   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 38
c 0
b 0
f 0
wmc 2
lcom 1
cbo 5
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 14 1
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