TransactionCollection   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 24
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A getPageData() 0 3 1
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 TransactionCollection 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