You are here

public function ClosureExpressionVisitor::walkCompositeExpression in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php \Doctrine\Common\Collections\Expr\ClosureExpressionVisitor::walkCompositeExpression()

Converts a composite expression into the target query language output.

Parameters

CompositeExpression $expr:

Return value

mixed

Overrides ExpressionVisitor::walkCompositeExpression

File

vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php, line 174

Class

ClosureExpressionVisitor
Walks an expression graph and turns it into a PHP closure.

Namespace

Doctrine\Common\Collections\Expr

Code

public function walkCompositeExpression(CompositeExpression $expr) {
  $expressionList = array();
  foreach ($expr
    ->getExpressionList() as $child) {
    $expressionList[] = $this
      ->dispatch($child);
  }
  switch ($expr
    ->getType()) {
    case CompositeExpression::TYPE_AND:
      return $this
        ->andExpressions($expressionList);
    case CompositeExpression::TYPE_OR:
      return $this
        ->orExpressions($expressionList);
    default:
      throw new \RuntimeException("Unknown composite " . $expr
        ->getType());
  }
}