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

OffsetBuilder::buildOffset()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
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