| @@ 10-39 (lines=30) @@ | ||
| 7 | /** |
|
| 8 | * Test for equality |
|
| 9 | */ |
|
| 10 | class LogicalAndOp implements OperatorInterface |
|
| 11 | { |
|
| 12 | protected $lhs; |
|
| 13 | protected $rhs; |
|
| 14 | ||
| 15 | public function __construct($lhs, $rhs) |
|
| 16 | { |
|
| 17 | $this->lhs = $lhs; |
|
| 18 | $this->rhs = $rhs; |
|
| 19 | } |
|
| 20 | ||
| 21 | /** |
|
| 22 | * Test the provided value to see if it matches our criteria. |
|
| 23 | * |
|
| 24 | * @param mixed $value |
|
| 25 | * @return bool |
|
| 26 | */ |
|
| 27 | public function test(Data $row) |
|
| 28 | { |
|
| 29 | return $this->lhs->test($row) && $this->rhs->test($row); |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Return a string representation of this operator |
|
| 34 | */ |
|
| 35 | public function __toString() |
|
| 36 | { |
|
| 37 | return "{$this->lhs}&&{$this->rhs}"; |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| @@ 10-39 (lines=30) @@ | ||
| 7 | /** |
|
| 8 | * Test for equality |
|
| 9 | */ |
|
| 10 | class LogicalOrOp implements OperatorInterface |
|
| 11 | { |
|
| 12 | protected $lhs; |
|
| 13 | protected $rhs; |
|
| 14 | ||
| 15 | public function __construct($lhs, $rhs) |
|
| 16 | { |
|
| 17 | $this->lhs = $lhs; |
|
| 18 | $this->rhs = $rhs; |
|
| 19 | } |
|
| 20 | ||
| 21 | /** |
|
| 22 | * Test the provided value to see if it matches our criteria. |
|
| 23 | * |
|
| 24 | * @param mixed $value |
|
| 25 | * @return bool |
|
| 26 | */ |
|
| 27 | public function test(Data $row) |
|
| 28 | { |
|
| 29 | return $this->lhs->test($row) || $this->rhs->test($row); |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Return a string representation of this operator |
|
| 34 | */ |
|
| 35 | public function __toString() |
|
| 36 | { |
|
| 37 | return "{$this->lhs}||{$this->rhs}"; |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||