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

LimitTrait::buildLimit()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
crap 2
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
 * A trait for LIMIT clauses.
14
 *
15
 * @package Aura.SqlQuery
16
 *
17
 */
18
trait LimitTrait
19
{
20
    protected $limit = 0;
21
22
    /**
23
     *
24
     * Sets a limit count on the query.
25
     *
26
     * @param int $limit The number of rows to select.
27
     *
28
     * @return $this
29
     *
30
     */
31 55
    public function limit($limit)
32
    {
33 55
        $this->limit = (int) $limit;
34 55
        return $this;
35
    }
36
37
    /**
38
     *
39
     * Returns the LIMIT value.
40
     *
41
     * @return int
42
     *
43
     */
44 68
    public function getLimit()
45
    {
46 68
        return $this->limit;
47
    }
48
}
49