1: <?php
2:
3: namespace PHPixie\Database\Conditions\Condition;
4:
5: abstract class Implementation implements \PHPixie\Database\Conditions\Condition
6: {
7: protected $allowedLogic = array('and', 'or', 'xor');
8:
9: protected $isNegated = false;
10: protected $logic = 'and';
11:
12: public function logic()
13: {
14: return $this->logic;
15: }
16:
17: public function setLogic($logic)
18: {
19: if(!in_array($logic, $this->allowedLogic))
20: throw new \PHPixie\Database\Exception\Builder("The '$logic' logic is not supported");
21:
22: $this->logic = $logic;
23: return $this;
24: }
25:
26: public function negate()
27: {
28: $this->isNegated = !$this->isNegated;
29:
30: return $this;
31: }
32:
33: public function isNegated()
34: {
35: return $this->isNegated;
36: }
37:
38: public function setIsNegated($isNegated)
39: {
40: if($isNegated !== $this->isNegated())
41: $this->negate();
42:
43: return $this;
44: }
45:
46: }
47: