1 | <?php |
||
9 | class Condition implements ConditionInterface |
||
10 | { |
||
11 | /** @var string Relation logic between arguments */ |
||
12 | public $relation = ConditionInterface::CONJUNCTION; |
||
13 | |||
14 | /** @var Argument[] Collection of condition arguments */ |
||
15 | protected $arguments = array(); |
||
16 | |||
17 | /** |
||
18 | * Add condition argument to this condition group |
||
19 | * @param ArgumentInterface $argument Condition argument to be added |
||
20 | * @return self Chaining |
||
21 | */ |
||
22 | public function addArgument(ArgumentInterface $argument) |
||
29 | |||
30 | /** |
||
31 | * Add condition group to this condition group |
||
32 | * @param ConditionInterface $condition Condition group to be added |
||
33 | * @return self Chaining |
||
34 | */ |
||
35 | public function addCondition(ConditionInterface $condition) |
||
42 | |||
43 | /** |
||
44 | * Generic condition addiction function |
||
45 | * @param string $argument Entity for adding to arguments collection |
||
46 | * @param mixed $value Argument value |
||
47 | * @param string $relation Relation between argument and value |
||
48 | * @return self Chaining |
||
49 | */ |
||
50 | public function add($argument, $value, $relation = ArgumentInterface::EQUAL) |
||
59 | |||
60 | /** |
||
61 | * Constructor |
||
62 | * @param string $relation Relation type between arguments |
||
63 | */ |
||
64 | public function __construct($relation = null) |
||
68 | |||
69 | /** |
||
70 | * Return the current element |
||
71 | * @link http://php.net/manual/en/iterator.current.php |
||
72 | * @return mixed Can return any type. |
||
73 | * @since 5.0.0 |
||
74 | */ |
||
75 | public function current() |
||
79 | |||
80 | /** |
||
81 | * Move forward to next element |
||
82 | * @link http://php.net/manual/en/iterator.next.php |
||
83 | * @return void Any returned value is ignored. |
||
84 | * @since 5.0.0 |
||
85 | */ |
||
86 | public function next() |
||
90 | |||
91 | /** |
||
92 | * Return the key of the current element |
||
93 | * @link http://php.net/manual/en/iterator.key.php |
||
94 | * @return mixed scalar on success, or null on failure. |
||
95 | * @since 5.0.0 |
||
96 | */ |
||
97 | public function key() |
||
101 | |||
102 | /** |
||
103 | * Checks if current position is valid |
||
104 | * @link http://php.net/manual/en/iterator.valid.php |
||
105 | * @return boolean The return value will be casted to boolean and then evaluated. |
||
106 | * Returns true on success or false on failure. |
||
107 | * @since 5.0.0 |
||
108 | */ |
||
109 | public function valid() |
||
113 | |||
114 | /** |
||
115 | * Rewind the Iterator to the first element |
||
116 | * @link http://php.net/manual/en/iterator.rewind.php |
||
117 | * @return void Any returned value is ignored. |
||
118 | * @since 5.0.0 |
||
119 | */ |
||
120 | public function rewind() |
||
124 | } |
||
125 |