Completed
Pull Request — master (#5)
by Daniel
08:08 queued 06:02
created

Paginator::getLastPage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Psi\Component\Grid;
6
7
class Paginator
8
{
9
    private $pageSize;
10
    private $currentPage;
11
    private $numberOfRecords;
12
13
    public function __construct(int $pageSize, int $currentPage, int $numberOfRecords = null)
14
    {
15
        $this->pageSize = $pageSize;
16
        $this->currentPage = $currentPage;
17
        $this->numberOfRecords = $numberOfRecords;
18
    }
19
20
    public function getPageSize(): int
21
    {
22
        return $this->pageSize;
23
    }
24
25
    public function getCurrentPage(): int
26
    {
27
        return $this->currentPage;
28
    }
29
30
    public function getNumberOfRecords(): int
31
    {
32
        return $this->numberOfRecords;
33
    }
34
35
    public function getLastPage(): int
36
    {
37
        return (int) ceil($this->numberOfRecords / $this->pageSize);
38
    }
39
}
40