'ogc:PropertyIsLike wildCard="*" singleChar="#" escapeChar="!"',
"close" => 'ogc:PropertyIsLike'
);
break;
case "AND":
return array(
"open" => 'ogc:And',
"close" => 'ogc:And'
);
break;
default:
return array(
"open" => $op,
"close" => $op
);
}
}
public function __construct () {
$allOperators = implode(",", array(self::OPERATORS, self::SPATIAL_OPERATORS));
if (func_num_args() >= 3) {
$this->operator = func_get_arg(0);
$this->key = func_get_arg(1);
$this->value = func_get_arg(2);
if (func_num_args() >= 4) {
$this->wfsConf = func_get_arg(3);
if (!is_a($this->wfsConf, "WfsConfiguration")) {
throw new Exception ("OgcFilter: wfsConf is not a WFS Configuration.");
}
}
if (!in_array($this->operator, explode(",", $allOperators))) {
throw new Exception ("OgcFilter: Invalid operator " . $this->operator);
}
}
else if (func_num_args() === 2) {
$logicalOp = func_get_arg(0);
$filterArray = func_get_arg(1);
return parent::__construct($logicalOp, $filterArray);
}
else {
throw new Exception("OgcFilter: Insufficient arguments.");
}
}
public function toXmlNoWrap() {
if ($this->isComplex()) {
$str = "";
foreach ($this->filterArray as $filter) {
$str .= $filter->toXmlNoWrap();
}
$op = $this->mapOperator($this->booleanOperator);
return "<" . $op["open"] . ">" . $str . "" . $op["close"] . ">";
}
else {
$k = "" . $this->key . "";
if (in_array($this->operator, explode(",", self::SPATIAL_OPERATORS))) {
$gmlFactory = new UniversalGmlFactory();
$gml = $gmlFactory->createFromGeoJson($this->value, $this->wfsConf);
$v = $gml->toGml();
}
else {
$v = "" . $this->value . "";
}
$op = $this->mapOperator($this->operator);
return "<" . $op["open"] . ">" . $k . $v . "" . $op["close"] . ">";
}
}
public function toXml () {
return "" . $this->toXmlNoWrap() . "";
}
}
?>