Completed
Push — 3.x ( e5eb1c...76cecd )
by Paul
9s
created

LimitOffsetTrait::buildLimit()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 19
ccs 8
cts 8
cp 1
rs 9.2
c 0
b 0
f 0
cc 4
eloc 10
nc 8
nop 0
crap 4
1
<?php
2
/**
3
 *
4
 * This file is part of Aura for PHP.
5
 *
6
 * @license http://opensource.org/licenses/bsd-license.php BSD
7
 *
8
 */
9
namespace Aura\SqlQuery\Common;
10
11
/**
12
 *
13
 * An interface for LIMIT...OFFSET clauses.
14
 *
15
 * @package Aura.SqlQuery
16
 *
17
 */
18
trait LimitOffsetTrait
19
{
20
    use LimitTrait;
21
22
    protected $offset = 0;
23
24
    /**
25
     *
26
     * Sets a limit offset on the query.
27
     *
28
     * @param int $offset Start returning after this many rows.
29
     *
30
     * @return $this
31
     *
32
     */
33 44
    public function offset($offset)
34
    {
35 44
        $this->offset = (int) $offset;
36 44
        return $this;
37
    }
38
39
    /**
40
     *
41
     * Returns the OFFSET value.
42
     *
43
     * @return int
44
     *
45
     */
46 12
    public function getOffset()
47
    {
48 12
        return $this->offset;
49
    }
50
}
51