/**
  * Calls visitArrayFetchOperator() of the ezcTemplateBasicAstNodeVisitor interface.
  *
  * @param ezcTemplateAstNodeVisitor $visitor 
  *        The visitor object which can visit the current code element.
  * @return ezcTemplateAstNode
  */
 public function accept(ezcTemplateAstNodeVisitor $visitor)
 {
     $visitor->visitArrayFetchOperatorAstNode($this);
 }
Beispiel #2
0
 /**
  * Checks if the visitor object is accepted and if so calls the appropriate
  * visitor method in it.
  *
  * Calls visitUnaryOperator if it has one parameter, visitBinaryOperator() if it has two and visitTernaryOperator() if it has three.
  * All part of the ezcTemplateBasicAstNodeVisitor interface.
  *
  * @param ezcTemplateAstNodeVisitor $visitor
  * @return ezcTemplateAstNode
  */
 public function accept(ezcTemplateAstNodeVisitor $visitor)
 {
     $count = count($this->parameters);
     if ($count == 1) {
         $visitor->visitUnaryOperatorAstNode($this);
     } else {
         if ($count == 2) {
             $visitor->visitBinaryOperatorAstNode($this);
         } else {
             if ($count == 3) {
                 $visitor->visitTernaryOperatorAstNode($this);
             } else {
                 throw new ezcTemplateInternalException("Operator can only have 1, 2 or 3 operands but this has {$count}");
             }
         }
     }
 }