5 class Expressible
implements ExpressibleInterface
21 function __construct($name, $data) {
30 function __toString() {
31 return (string) $this->data
;
35 * Test whether the value is an unevaluated expression
39 return $this->data
instanceof Expr
;
53 * @return \pq\Query\Expressible
63 * @param string $op a specific operator
64 * @return \pq\Query\Expressible
66 function mod($data, $op = null) {
67 if (!($this->data
instanceof Expr
)) {
68 $this->data
= new Expr($this->name
);
71 if ($data instanceof Expr
) {
72 $this->data
->add($data);
73 } elseif (!isset($op) && is_numeric($data)) {
74 $this->data
->add(new Expr("+ $data"));
76 $this->data
->add(new Expr("%s %s", isset($op) ?
$op : "||", $data));