Passed
Push — master ( 70ce04...9471d7 )
by Jean-Christophe
03:03
created

ObjectsConditionParser   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 48
ccs 21
cts 21
cp 1
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A isFull() 0 2 1
A addObject() 0 2 1
A getConditionParser() 0 2 1
A getObjects() 0 2 1
A __construct() 0 3 1
A addPartObject() 0 3 1
A compileParts() 0 2 1
A hasParam() 0 2 1
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 4
	public function __construct(){
19 4
		$this->conditionParser=new ConditionParser();
20 4
		$this->objects=[];
21 4
	}
22
	
23 4
	public function addPartObject($object,$condition,$value){
24 4
		$this->objects[]=$object;
25 4
		return $this->conditionParser->addPart($condition, $value);
26
	}
27
	/**
28
	 * @return \Ubiquity\orm\parser\ConditionParser
29
	 */
30 4
	public function getConditionParser() {
31 4
		return $this->conditionParser;
32
	}
33
34
	/**
35
	 * @return array
36
	 */
37 4
	public function getObjects() {
38 4
		return $this->objects;
39
	}
40
	
41 4
	public function hasParam($value){
42 4
		return $this->conditionParser->hasParam($value);
43
	}
44
	
45 4
	public function compileParts($separator=" OR "){
46 4
		$this->conditionParser->compileParts($separator);
47 4
	}
48
	
49 3
	public function addObject($object){
50 3
		$this->objects[]=$object;
51 3
	}
52
	
53 4
	public function isFull(){
54 4
		return $this->conditionParser->countParts()>=PendingRelationsRequest::$MAX_ROW_COUNT;
55
	}
56
}
57
58