示例#1
0
 public function testToString()
 {
     $expr1 = new Not(new StartsWith('Thomas'));
     $expr2 = new Not(new OrX(array(new GreaterThan(10), new LessThan(0))));
     $this->assertSame('not(startsWith("Thomas"))', $expr1->toString());
     $this->assertSame('not(>10 || <0)', $expr2->toString());
 }
 private function traverseNot(Not $expr)
 {
     $negatedExpr1 = $expr->getNegatedExpression();
     $negatedExpr2 = $this->traverse($negatedExpr1);
     if ($negatedExpr1 === $negatedExpr2) {
         return $expr;
     }
     return $negatedExpr2 ? new Not($negatedExpr2) : null;
 }