Pagination::getPage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace ElevenLabs\Api\Service\Pagination;
3
4
class Pagination
5
{
6
    /** @var int */
7
    private $page;
8
    /** @var int */
9
    private $perPage;
10
    /** @var int */
11
    private $totalItems;
12
    /** @var int */
13
    private $totalPages;
14
    /** @var null */
15
    private $links;
16
17
    /**
18
     * @param int $page
19
     * @param int $perPage
20
     * @param int $totalItems
21
     * @param int $totalPages
22
     * @param $links
23
     */
24 8
    public function __construct($page, $perPage, $totalItems, $totalPages, $links = null)
25
    {
26 8
        $this->page = $page;
27 8
        $this->perPage = $perPage;
28 8
        $this->totalItems = $totalItems;
29 8
        $this->totalPages = $totalPages;
30 8
        $this->links = $links;
31 8
    }
32
33
    /**
34
     * @return int
35
     */
36 5
    public function getPage()
37
    {
38 5
        return $this->page;
39
    }
40
41
    /**
42
     * @return int
43
     */
44 5
    public function getPerPage()
45
    {
46 5
        return $this->perPage;
47
    }
48
49
    /**
50
     * @return int
51
     */
52 5
    public function getTotalItems()
53
    {
54 5
        return $this->totalItems;
55
    }
56
57
    /**
58
     * @return int
59
     */
60 5
    public function getTotalPages()
61
    {
62 5
        return $this->totalPages;
63
    }
64
65 1
    public function hasLinks()
66
    {
67 1
        return ($this->links !== null);
68
    }
69
70
    /**
71
     * @return PaginationLinks
72
     */
73 4
    public function getLinks()
74
    {
75 4
        return $this->links;
76
    }
77
}
78