PaginatedResourceCollection   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 64
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getPage() 0 4 1
A getLimit() 0 4 1
A getTotal() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
/*
6
 * This file is part of the FiveLab Resource package
7
 *
8
 * (c) FiveLab
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code
12
 */
13
14
namespace FiveLab\Component\Resource\Resource;
15
16
/**
17
 * Paginated resource collection.
18
 *
19
 * @author Vitaliy Zhuk <[email protected]>
20
 */
21
class PaginatedResourceCollection extends ResourceCollection
22
{
23
    /**
24
     * @var int
25
     */
26
    private $limit;
27
28
    /**
29
     * @var int
30
     */
31
    private $page;
32
33
    /**
34
     * @var int
35
     */
36
    private $total;
37
38
    /**
39
     * Constructor.
40
     *
41
     * @param int               $page
42
     * @param int               $limit
43
     * @param int               $total
44
     * @param ResourceInterface ...$resources
45
     */
46 3
    public function __construct(int $page, int $limit, int $total, ResourceInterface ...$resources)
47
    {
48 3
        parent::__construct(...$resources);
49
50 3
        $this->page = $page;
51 3
        $this->limit = $limit;
52 3
        $this->total = $total;
53 3
    }
54
55
    /**
56
     * Get page
57
     *
58
     * @return int
59
     */
60 3
    public function getPage(): int
61
    {
62 3
        return $this->page;
63
    }
64
65
    /**
66
     * Get limit
67
     *
68
     * @return int
69
     */
70 3
    public function getLimit(): int
71
    {
72 3
        return $this->limit;
73
    }
74
75
    /**
76
     * Get the count of total items
77
     *
78
     * @return int
79
     */
80 3
    public function getTotal(): int
81
    {
82 3
        return $this->total;
83
    }
84
}
85