Passed
Push — master ( e21ea4...5cdd3c )
by Laurens
01:37
created

SubscriptionTransactionCollection::loadPage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LauLamanApps\eCurring\Resource;
6
7
use LauLamanApps\eCurring\eCurringClientInterface;
8
use LauLamanApps\eCurring\Resource\Curser\Pagination;
9
10
/**
11
 * @method Transaction[] getAll()
12
 * @method Transaction current()
13
 */
14
final class SubscriptionTransactionCollection extends Cursor
15
{
16
    /**
17
     * @var Subscription
18
     */
19
    private $subscription;
20
21
    public function __construct(
22
        Subscription $subscription,
23
        eCurringClientInterface $client,
24
        int $currentPage,
25
        int $totalPages,
26
        array $objects,
27
        ?int $itemsPerPage = 10,
28
        ?bool $autoload = true
29
    ) {
30
        parent::__construct($client, $currentPage, $totalPages, $objects, $itemsPerPage, $autoload);
31
32
        $this->subscription = $subscription;
33
    }
34
35
    protected function getPageData(int $number, int $itemsPerPage): Cursor
36
    {
37
        return $this->client->getSubscriptionTransactions($this->subscription, new Pagination($itemsPerPage, $number));
38
    }
39
}
40