GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Page::getPage()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Tuum\Pagination\Paginate;
3
4
class Page
5
{
6
    /**
7
     * @var int
8
     */
9
    private $currPage;
10
11
    /**
12
     * set $page to 0 to disable the page.
13
     *
14
     * @var int
15
     */
16
    private $page;
17
18
    /**
19
     * @var string
20
     */
21
    private $pagerKey;
22
23
    /**
24
     * Page constructor.
25
     *
26
     * @param string $key
27
     * @param int $currPage
28
     * @param int $page
29
     */
30
    public function __construct($key, $currPage, $page)
31
    {
32
        $this->pagerKey = $key;
33
        $this->currPage = (int) $currPage;
34
        $this->page = (int) $page;
35
    }
36
37
    /**
38
     * @return int
39
     */
40
    public function getPage()
41
    {
42
        return (int) $this->page ?: '';
43
    }
44
45
    /**
46
     * @param bool|string $true
47
     * @param bool|string $false
48
     * @return bool|string
49
     */
50
    public function isCurrent($true = true, $false = false)
51
    {
52
        return $this->currPage === $this->page 
53
            ? $true: $false;
54
    }
55
56
    /**
57
     * @param bool|string $true
58
     * @param bool|string $false
59
     * @return bool|string
60
     */
61
    public function isDisabled($true = true, $false = false)
62
    {
63
        return !$this->page
64
            ? $true: $false;
65
    }
66
67
    /**
68
     * @return string
69
     */
70
    public function getUrl()
71
    {
72
        if ($this->isDisabled() || $this->isCurrent()) {
73
            return '#';
74
        }
75
        return "?{$this->pagerKey}={$this->page}";
76
    }
77
}