You are here

abstract class ExpressionVisitor in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php \Doctrine\Common\Collections\Expr\ExpressionVisitor

An Expression visitor walks a graph of expressions and turns them into a query for the underlying implementation.

@author Benjamin Eberlei <kontakt@beberlei.de>

Hierarchy

Expanded class hierarchy of ExpressionVisitor

File

vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php, line 28

Namespace

Doctrine\Common\Collections\Expr
View source
abstract class ExpressionVisitor {

  /**
   * Converts a comparison expression into the target query language output.
   *
   * @param Comparison $comparison
   *
   * @return mixed
   */
  public abstract function walkComparison(Comparison $comparison);

  /**
   * Converts a value expression into the target query language part.
   *
   * @param Value $value
   *
   * @return mixed
   */
  public abstract function walkValue(Value $value);

  /**
   * Converts a composite expression into the target query language output.
   *
   * @param CompositeExpression $expr
   *
   * @return mixed
   */
  public abstract function walkCompositeExpression(CompositeExpression $expr);

  /**
   * Dispatches walking an expression to the appropriate handler.
   *
   * @param Expression $expr
   *
   * @return mixed
   *
   * @throws \RuntimeException
   */
  public function dispatch(Expression $expr) {
    switch (true) {
      case $expr instanceof Comparison:
        return $this
          ->walkComparison($expr);
      case $expr instanceof Value:
        return $this
          ->walkValue($expr);
      case $expr instanceof CompositeExpression:
        return $this
          ->walkCompositeExpression($expr);
      default:
        throw new \RuntimeException("Unknown Expression " . get_class($expr));
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ExpressionVisitor::dispatch public function Dispatches walking an expression to the appropriate handler.
ExpressionVisitor::walkComparison abstract public function Converts a comparison expression into the target query language output. 1
ExpressionVisitor::walkCompositeExpression abstract public function Converts a composite expression into the target query language output. 1
ExpressionVisitor::walkValue abstract public function Converts a value expression into the target query language part. 1