class Composer{
var $text;
var $values;
public function __construct(){
$this->text = "";
$this->values = array();
}
public function composeCompare($compare){
$this->text = "(" . $compare->field . " = " . $compare->value . ")";
}
public function composeRange($range){
$this->text = "(" . $compare->field . " >= " . $compare->valueFrom . " and " .$compare->field . " <= " . $compare->valueTo . ")";
}
public function composeOperator($op){
$this->text = $op->op;
}
public function composeComplex($complex){
$text = "(";
foreach($complex->filters as $filter){
$filter->compose($this);
$text .= " " . $this->text . " ";
}
$text .= ")";
$this->text = $text;
}
}