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.
Completed
Push — master ( c21a18...869bac )
by Asao
01:28
created

Page   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 8
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 68
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getPage() 0 4 2
A isCurrent() 0 4 1
A isDisabled() 0 4 1
A getUrl() 0 7 3
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 $this->page ?: '';
43
    }
44
45
    /**
46
     * @return bool
47
     */
48
    public function isCurrent()
49
    {
50
        return $this->currPage === $this->page;
51
    }
52
53
    /**
54
     * @return bool
55
     */
56
    public function isDisabled()
57
    {
58
        return !$this->page;
59
    }
60
61
    /**
62
     * @return string
63
     */
64
    public function getUrl()
65
    {
66
        if ($this->isDisabled() || $this->isCurrent()) {
67
            return '#';
68
        }
69
        return "?{$this->pagerKey}={$this->page}";
70
    }
71
}