Completed
Pull Request — master (#156)
by
unknown
01:44
created

Pagination   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 69
rs 10
c 0
b 0
f 0
wmc 7
lcom 0
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 3
A getOffset() 0 4 1
A setOffset() 0 4 1
A getLimit() 0 4 1
A setLimit() 0 4 1
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