public function orX(Expression $expr)
{
if ($expr instanceof AlwaysFalse) {
return $this;
} elseif ($expr instanceof AlwaysTrue) {
return $expr;
}
foreach ($this->disjuncts as $disjunct) {
if ($disjunct->equivalentTo($expr)) {
return $this;
}
}
$disjuncts = $this->disjuncts;
if ($expr instanceof self) {
$disjuncts = array_merge($disjuncts, $expr->disjuncts);
} else {
$disjuncts[] = $expr;
}
return new self($disjuncts);
}