Completed
Push — master ( 9ef975...f27292 )
by Ron
02:46
created

OffsetBuilder::getOffset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace Kir\MySQL\Builder\Traits;
3
4
trait OffsetBuilder {
5
	/** @var int */
6
	private $offset = null;
7
8
	/**
9
	 * @return int
10
	 */
11
	protected function getOffset() {
12
		return $this->offset;
13
	}
14
15
	/**
16
	 * @param int $offset
17
	 * @return $this
18
	 */
19
	public function offset($offset) {
20
		$this->offset = $offset;
21
		return $this;
22
	}
23
24
	/**
25
	 * @param string $query
26
	 * @return string
27
	 */
28
	protected function buildOffset($query) {
29
		if($this->offset !== null) {
30
			$query .= "OFFSET\n\t{$this->offset}\n";
31
		}
32
		return $query;
33
	}
34
}
35