code: private function convertSwitchToIfelse(Stmt\Switch_ $node)
      {
          $stmt = array(
              'else' => null,
              'elseifs' => array(),
          );
          $if = null;
          $ifDefined = false;
          $left = null;
          foreach ($node->cases as $case) {
              $case = $this->removeBreakStmt($case);
              if (end($node->cases) === $case) {
                  $stmt['else'] = new Stmt\Else_($case->stmts);
              } else {
                  if (empty($case->stmts)) { // concatene empty statement
                      if ($left !== null) {
                          $left = new BinaryOp\BooleanOr($left, $case->cond);
                      } else {
                          $left = $case->cond;
                      }
                  } elseif ($ifDefined === false) {
                      if ($left !== null) {
                          $lastLeft = new BinaryOp\BooleanOr($left, $case->cond);
                          $if = new Stmt\If_($lastLeft, array('stmts' => $case->stmts));
                          $left = null;
                      } else {
                          $if = new Stmt\If_($case->cond, array('stmts' => $case->stmts));
                      }
                      $ifDefined = true;
                  } else {
                      if ($left !== null) {
                          $lastLeft = new BinaryOp\BooleanOr($left, $case->cond);
                          $stmt['elseifs'][] = new Stmt\ElseIf_($lastLeft, $case->stmts);
                          $left = null;
                      } else {
                          $stmt['elseifs'][] = new Stmt\ElseIf_($case->cond, $case->stmts);
                      }
                  }
              }
          }
          $elseifs = array_reverse($stmt['elseifs']);
          $if = new Stmt\If_($if->cond, array(
              'stmts' => $if->stmts,
              'elseifs' => $elseifs,
              'else' => $stmt['else'],
          ));
  
          return $this->dispatcher->pStmt_If($if);
      }
docs: @param Stmt\Switch_ $node
  
  @return string