original_string: private function processStreamCallback(string $task, ...$params)
      {
          if (! isset($this->stream)) {
              throw new \RuntimeException('Stream is detached');
          }
  
          $task = strtolower($task);
          $fn = 'f';
          if ($this->streamType === 'ZLIB') {
              if ($task === 'stat') {
                  return false;
              }
              $fn = 'gz';
          }
          // default using f$task -> eg fopen() on gzip using gzopen
          $fn   .= $task;
          if (! function_exists($fn)) {
              return false;
          }
          switch ($task) {
              case 'seek':
              case 'write':
                  if ($task === 'seek' && ! $this->seekable) {
                      throw new \RuntimeException('Stream is not seekable');
                  } elseif ($task === 'write' && ! $this->writable) {
                      throw new \RuntimeException('Cannot write to a non-writable stream');
                  }
  
                  if (isset($params[1])) {
                     return $fn($this->stream, $params[0], $params[1]);
                  }
                  return $fn($this->stream, $params[0]);
              case 'read':
                  return $fn($this->stream, $params[0]);
              default:
                  return $fn($this->stream, ...$params);
          }
      }
code: private function processStreamCallback(string $task, ...$params)
      {
          if (! isset($this->stream)) {
              throw new \RuntimeException('Stream is detached');
          }
  
          $task = strtolower($task);
          $fn = 'f';
          if ($this->streamType === 'ZLIB') {
              if ($task === 'stat') {
                  return false;
              }
              $fn = 'gz';
          }
          // default using f$task -> eg fopen() on gzip using gzopen
          $fn   .= $task;
          if (! function_exists($fn)) {
              return false;
          }
          switch ($task) {
              case 'seek':
              case 'write':
                  if ($task === 'seek' && ! $this->seekable) {
                      throw new \RuntimeException('Stream is not seekable');
                  } elseif ($task === 'write' && ! $this->writable) {
                      throw new \RuntimeException('Cannot write to a non-writable stream');
                  }
  
                  if (isset($params[1])) {
                     return $fn($this->stream, $params[0], $params[1]);
                  }
                  return $fn($this->stream, $params[0]);
              case 'read':
                  return $fn($this->stream, $params[0]);
              default:
                  return $fn($this->stream, ...$params);
          }
      }
code_tokens: private function processStreamCallback ( string $ task , ... $ params ) { if ( ! isset ( $ this -> stream ) ) { throw new \ RuntimeException ( 'Stream is detached' ) ; } $ task = strtolower ( $ task ) ; $ fn = 'f' ; if ( $ this -> streamType === 'ZLIB' ) { if ( $ task === 'stat' ) { return false ; } $ fn = 'gz' ; } // default using f$task -> eg fopen() on gzip using gzopen $ fn .= $ task ; if ( ! function_exists ( $ fn ) ) { return false ; } switch ( $ task ) { case 'seek' : case 'write' : if ( $ task === 'seek' && ! $ this -> seekable ) { throw new \ RuntimeException ( 'Stream is not seekable' ) ; } elseif ( $ task === 'write' && ! $ this -> writable ) { throw new \ RuntimeException ( 'Cannot write to a non-writable stream' ) ; } if ( isset ( $ params [ 1 ] ) ) { return $ fn ( $ this -> stream , $ params [ 0 ] , $ params [ 1 ] ) ; } return $ fn ( $ this -> stream , $ params [ 0 ] ) ; case 'read' : return $ fn ( $ this -> stream , $ params [ 0 ] ) ; default : return $ fn ( $ this -> stream , ... $ params ) ; } }
docstring: Helper callback processor
  
  @param string $task
  @param array ...$params
  
  @return array|bool|int|string
  @access private
docstring_tokens: Helper callback processor