original_string: private function popStreamContentUntilCurrentSection(int $numberOfLinesToClearFromCurrentSection = 0): string
      {
          $numberOfLinesToClear = $numberOfLinesToClearFromCurrentSection;
          $erasedContent = [];
  
          foreach ($this->sections as $section) {
              if ($section === $this) {
                  break;
              }
  
              $numberOfLinesToClear += $section->lines;
              $erasedContent[] = $section->getContent();
          }
  
          if ($numberOfLinesToClear > 0) {
              // move cursor up n lines
              parent::doWrite(sprintf("\x1b[%dA", $numberOfLinesToClear), false);
              // erase to end of screen
              parent::doWrite("\x1b[0J", false);
          }
  
          return implode('', array_reverse($erasedContent));
      }
code: private function popStreamContentUntilCurrentSection(int $numberOfLinesToClearFromCurrentSection = 0): string
      {
          $numberOfLinesToClear = $numberOfLinesToClearFromCurrentSection;
          $erasedContent = [];
  
          foreach ($this->sections as $section) {
              if ($section === $this) {
                  break;
              }
  
              $numberOfLinesToClear += $section->lines;
              $erasedContent[] = $section->getContent();
          }
  
          if ($numberOfLinesToClear > 0) {
              // move cursor up n lines
              parent::doWrite(sprintf("\x1b[%dA", $numberOfLinesToClear), false);
              // erase to end of screen
              parent::doWrite("\x1b[0J", false);
          }
  
          return implode('', array_reverse($erasedContent));
      }
code_tokens: private function popStreamContentUntilCurrentSection ( int $ numberOfLinesToClearFromCurrentSection = 0 ) : string { $ numberOfLinesToClear = $ numberOfLinesToClearFromCurrentSection ; $ erasedContent = [ ] ; foreach ( $ this -> sections as $ section ) { if ( $ section === $ this ) { break ; } $ numberOfLinesToClear += $ section -> lines ; $ erasedContent [ ] = $ section -> getContent ( ) ; } if ( $ numberOfLinesToClear > 0 ) { // move cursor up n lines parent :: doWrite ( sprintf ( "\x1b[%dA" , $ numberOfLinesToClear ) , false ) ; // erase to end of screen parent :: doWrite ( "\x1b[0J" , false ) ; } return implode ( '' , array_reverse ( $ erasedContent ) ) ; }
docstring: At initial stage, cursor is at the end of stream output. This method makes cursor crawl upwards until it hits
  current section. Then it erases content it crawled through. Optionally, it erases part of current section too.
docstring_tokens: At initial stage cursor is at the end of stream output . This method makes cursor crawl upwards until it hits current section . Then it erases content it crawled through . Optionally it erases part of current section too .