OffsetLogicResult::setSize()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
3
/*
4
 * This file is part of the SomeWork/OffsetPage/Logic package.
5
 *
6
 * (c) Pinchuk Igor <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace SomeWork\OffsetPage\Logic;
13
14
class OffsetLogicResult
15
{
16
    /**
17
     * @var int
18
     */
19
    protected $page;
20
    /**
21
     * @var int
22
     */
23
    protected $size;
24
25
    public function __construct($page = 0, $size = 0)
26
    {
27
        $this->setPage($page);
28
        $this->setSize($size);
29
    }
30
31
    /**
32
     * @return int
33
     */
34
    public function getPage()
35
    {
36
        return $this->page;
37
    }
38
39
    /**
40
     * @param int $page
41
     *
42
     * @return $this
43
     */
44
    public function setPage($page)
45
    {
46
        $this->page = (int) $page >= 0 ? (int) $page : 0;
47
48
        return $this;
49
    }
50
51
    /**
52
     * @return int
53
     */
54
    public function getSize()
55
    {
56
        return $this->size;
57
    }
58
59
    /**
60
     * @param int $size
61
     *
62
     * @return $this
63
     */
64
    public function setSize($size)
65
    {
66
        $this->size = (int) $size > 0 ? (int) $size : 0;
67
68
        return $this;
69
    }
70
}
71