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 ( f21ed5...b54c16 )
by Andreas
04:24 queued 01:54
created

PageFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 14
c 1
b 0
f 1
dl 0
loc 35
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A createPage() 0 17 3
1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
6
namespace CommerceLeague\ActiveCampaignApi\Paginator;
7
8
use CommerceLeague\ActiveCampaignApi\Api\Operation\ListableResourceInterface;
9
use CommerceLeague\ActiveCampaignApi\Client\HttpClientInterface;
10
11
/**
12
 * Class PageFactory
13
 */
14
class PageFactory implements PageFactoryInterface
15
{
16
    /**
17
     * @var HttpClientInterface
18
     */
19
    private $httpClient;
20
21
    /**
22
     * @param HttpClientInterface $httpClient
23
     */
24
    public function __construct(HttpClientInterface $httpClient)
25
    {
26
        $this->httpClient = $httpClient;
27
    }
28
29
    /**
30
     * @inheritDoc
31
     */
32
    public function createPage(
33
        ListableResourceInterface $listableResource,
34
        array $item,
35
        array $meta
36
    ): PageInterface {
37
        $totalCount = (int)$meta['total'];
38
        $limit = isset($meta['page_input']) ? (int)$meta['page_input']['limit'] : null;
39
        $offset = isset($meta['page_input']) ? (int)$meta['page_input']['offset']: null;
40
41
        return new Page(
42
            new PageFactory($this->httpClient),
43
            $this->httpClient,
44
            $listableResource,
45
            $totalCount,
46
            $limit,
47
            $offset,
48
            $item
49
        );
50
    }
51
}
52