Esempio n. 1
0
 /**
  * @param Stmt\If_ $node
  *
  * @return string
  */
 private function implodeElseIfs(Stmt\If_ $node)
 {
     $elseCount = 0;
     $toReturn = '';
     foreach ($node->elseifs as $elseIf) {
         $collected = $this->assignManipulator->collectAssignInCondition($elseIf->cond);
         if (!empty($collected['extracted'])) {
             $elseCount++;
             $toReturn .= ' else { ' . "\n" . $this->dispatcher->p(new Stmt\If_($elseIf->cond, array('stmts' => $elseIf->stmts))) . "\n";
         } else {
             $toReturn .= $this->dispatcher->pStmt_ElseIf($elseIf);
         }
     }
     $toReturn .= null !== $node->else ? $this->dispatcher->p($node->else) : '';
     return $toReturn . str_repeat('}', $elseCount);
 }