Passed
Push — master ( 7d2b7a...0ea348 )
by Jean-Christophe
02:57
created

ObjectsConditionParser::addPartObject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Ubiquity\orm\core;
4
5
use Ubiquity\orm\parser\ConditionParser;
6
7
class ObjectsConditionParser {
8
	
9
	/**
10
	 * @var ConditionParser
11
	 */
12
	protected $conditionParser;
13
	/**
14
	 * @var array
15
	 */
16
	protected $objects;
17
	
18
	public function __construct(){
19
		$this->conditionParser=new ConditionParser();
20
		$this->objects=[];
21
	}
22
	
23
	public function addPartObject($object,$condition,$value){
24
		$this->objects[]=$object;
25
		return $this->conditionParser->addPart($condition, $value);
26
	}
27
	/**
28
	 * @return \Ubiquity\orm\parser\ConditionParser
29
	 */
30
	public function getConditionParser() {
31
		return $this->conditionParser;
32
	}
33
34
	/**
35
	 * @return array
36
	 */
37
	public function getObjects() {
38
		return $this->objects;
39
	}
40
	
41
	public function hasParam($value){
42
		return $this->conditionParser->hasParam($value);
43
	}
44
	
45
	public function compileParts($separator=" OR "){
46
		$this->conditionParser->compileParts($separator);
47
	}
48
	
49
	public function addObject($object){
50
		$this->objects[]=$object;
51
	}
52
	
53
	public function isFull(){
54
		return $this->conditionParser->countParts()>=PendingRelationsRequest::$MAX_ROW_COUNT;
55
	}
56
}
57
58