Passed
Push — master ( 45291c...cb5044 )
by David
01:16
created

Pagination::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace FlexyProject\GitHub;
4
5
/**
6
 * Pagination
7
 * Requests that return multiple items will be paginated to 30 items by default.
8
 *
9
 * @link    https://developer.github.com/v3/#pagination
10
 * @package FlexyProject\GitHub
11
 */
12
class Pagination
13
{
14
15
    /**
16
     * Specify further pages.
17
     *
18
     * @var int|null
19
     */
20
    protected $page = null;
21
22
    /**
23
     * Set a custom page size up to 100.
24
     *
25
     * @var int|null
26
     */
27
    protected $limit = null;
28
29
    /**
30
     * Pagination constructor.
31
     *
32
     * @param int|null $page
33
     * @param int|null $limit
34
     */
35
    public function __construct(int $page = null, int $limit = null)
36
    {
37
        $this->page  = $page;
38
        $this->limit = $limit;
39
    }
40
41
    /**
42
     * Get page
43
     *
44
     * @return int|null
45
     */
46
    public function getPage()
47
    {
48
        return $this->page;
49
    }
50
51
    /**
52
     * Set page
53
     *
54
     * @param int|null $page
55
     *
56
     * @return Pagination
57
     */
58
    public function setPage($page): Pagination
59
    {
60
        $this->page = $page;
61
62
        return $this;
63
    }
64
65
    /**
66
     * Get limit
67
     *
68
     * @return int|null
69
     */
70
    public function getLimit()
71
    {
72
        return $this->limit;
73
    }
74
75
    /**
76
     * Set limit
77
     *
78
     * @param int|null $limit
79
     *
80
     * @return Pagination
81
     */
82
    public function setLimit($limit): Pagination
83
    {
84
        $this->limit = $limit;
85
86
        return $this;
87
    }
88
}