Completed
Push — master ( df95c6...f74e51 )
by
unknown
13s
created

Pagination::setOffset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Moip\Helper;
4
5
/**
6
 * Class Pagination.
7
 */
8
class Pagination
9
{
10
    /**
11
     * @var int
12
     **/
13
    private $offset = 0;
14
15
    /**
16
     * @var int
17
     **/
18
    private $limit = 100;
19
20
    /**
21
     * Pagination constructor.
22
     *
23
     * @param int $limit
24
     * @param int $offset
25
     */
26
    public function __construct($limit = null, $offset = null)
27
    {
28
        if (!empty($limit)) {
29
            $this->limit = $limit;
30
        }
31
32
        if (!empty($offset)) {
33
            $this->offset = $offset;
34
        }
35
    }
36
37
    /**
38
     * Get offset.
39
     *
40
     * @return int
41
     */
42
    public function getOffset()
43
    {
44
        return $this->offset;
45
    }
46
47
    /**
48
     * Set offset.
49
     *
50
     * @param int $offset
51
     */
52
    public function setOffset($offset)
53
    {
54
        $this->offset = $offset;
55
    }
56
57
    /**
58
     * Get limit.
59
     *
60
     * @return int
61
     */
62
    public function getLimit()
63
    {
64
        return $this->limit;
65
    }
66
67
    /**
68
     * Set limit.
69
     *
70
     * @param int $limit
71
     */
72
    public function setLimit($limit)
73
    {
74
        $this->limit = $limit;
75
    }
76
}
77