A disjunction is a set of {@link Expression} instances connected by logical "or" operators.
Since: 1.0
Author: Bernhard Schussek (bschussek@gmail.com)
Inheritance: implements Webmozart\Expression\Expression
 private function traverseDisjunction(OrX $expr)
 {
     $disjuncts1 = $expr->getDisjuncts();
     $disjuncts2 = array();
     foreach ($disjuncts1 as $disjunct) {
         if ($disjunct = $this->traverse($disjunct)) {
             $disjuncts2[] = $disjunct;
         }
     }
     if ($disjuncts1 === $disjuncts2) {
         return $expr;
     }
     return $disjuncts2 ? new OrX($disjuncts2) : null;
 }
示例#2
0
 public function testToString()
 {
     $expr1 = new OrX();
     $expr2 = new OrX(array(new GreaterThan(10), new EndsWith('.css')));
     $expr3 = new OrX(array(new GreaterThan(10), new AndX(array(new Contains('foo'), new EndsWith('.css')))));
     $this->assertSame('', $expr1->toString());
     $this->assertSame('>10 || endsWith(".css")', $expr2->toString());
     $this->assertSame('>10 || (contains("foo") && endsWith(".css"))', $expr3->toString());
 }