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

OffsetBuilder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 4
c 3
b 0
f 1
lcom 1
cbo 0
dl 0
loc 31
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getOffset() 0 3 1
A offset() 0 4 1
A buildOffset() 0 6 2
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