original_string: public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
      {
          $message = '';
  
          if ($error) {
              if (isset($this->started[$id]['out'])) {
                  $message .= "\n";
                  unset($this->started[$id]['out']);
              }
              if (!isset($this->started[$id]['err'])) {
                  $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
                  $this->started[$id]['err'] = true;
              }
  
              $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
          } else {
              if (isset($this->started[$id]['err'])) {
                  $message .= "\n";
                  unset($this->started[$id]['err']);
              }
              if (!isset($this->started[$id]['out'])) {
                  $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
                  $this->started[$id]['out'] = true;
              }
  
              $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
          }
  
          return $message;
      }
code: public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
      {
          $message = '';
  
          if ($error) {
              if (isset($this->started[$id]['out'])) {
                  $message .= "\n";
                  unset($this->started[$id]['out']);
              }
              if (!isset($this->started[$id]['err'])) {
                  $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
                  $this->started[$id]['err'] = true;
              }
  
              $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
          } else {
              if (isset($this->started[$id]['err'])) {
                  $message .= "\n";
                  unset($this->started[$id]['err']);
              }
              if (!isset($this->started[$id]['out'])) {
                  $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
                  $this->started[$id]['out'] = true;
              }
  
              $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
          }
  
          return $message;
      }
code_tokens: public function progress ( $ id , $ buffer , $ error = false , $ prefix = 'OUT' , $ errorPrefix = 'ERR' ) { $ message = '' ; if ( $ error ) { if ( isset ( $ this -> started [ $ id ] [ 'out' ] ) ) { $ message .= "\n" ; unset ( $ this -> started [ $ id ] [ 'out' ] ) ; } if ( ! isset ( $ this -> started [ $ id ] [ 'err' ] ) ) { $ message .= sprintf ( '%s<bg=red;fg=white> %s </> ' , $ this -> getBorder ( $ id ) , $ errorPrefix ) ; $ this -> started [ $ id ] [ 'err' ] = true ; } $ message .= str_replace ( "\n" , sprintf ( "\n%s<bg=red;fg=white> %s </> " , $ this -> getBorder ( $ id ) , $ errorPrefix ) , $ buffer ) ; } else { if ( isset ( $ this -> started [ $ id ] [ 'err' ] ) ) { $ message .= "\n" ; unset ( $ this -> started [ $ id ] [ 'err' ] ) ; } if ( ! isset ( $ this -> started [ $ id ] [ 'out' ] ) ) { $ message .= sprintf ( '%s<bg=green;fg=white> %s </> ' , $ this -> getBorder ( $ id ) , $ prefix ) ; $ this -> started [ $ id ] [ 'out' ] = true ; } $ message .= str_replace ( "\n" , sprintf ( "\n%s<bg=green;fg=white> %s </> " , $ this -> getBorder ( $ id ) , $ prefix ) , $ buffer ) ; } return $ message ; }
docstring: Adds progress to a formatting session.
  
  @param string $id          The id of the formatting session
  @param string $buffer      The message to display
  @param bool   $error       Whether to consider the buffer as error
  @param string $prefix      The prefix for output
  @param string $errorPrefix The prefix for error output
  
  @return string
docstring_tokens: Adds progress to a formatting session .