Passed
Branch v1.4.0 (ac3196)
by Wanderson
01:13
created

Where   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 4 1
A values() 0 3 1
A __toString() 0 7 2
A __construct() 0 3 1
1
<?php
2
3
namespace Win\Database\Sql\Clauses;
4
5
/**
6
 * WHERE id = ?
7
 */
8
class Where
9
{
10
	private $filters;
11
	private $values;
12
13
	public function __construct()
14
	{
15
		$this->filters = [];
16
	}
17
18
	public function __toString()
19
	{
20
		if (count($this->filters)) {
21
			return ' WHERE ' . implode(' AND ', $this->filters);
22
		}
23
24
		return '';
25
	}
26
27
	public function add($column, $operator, $value)
28
	{
29
		$this->filters[] = $column . $operator . '?';
30
		$this->values[] = $value;
31
	}
32
33
	public function values()
34
	{
35
		return $this->values;
36
	}
37
}
38