original_string: public function processUntil($event, $timeout=-1) {
  		$start = time();
  		if(!is_array($event)) $event = array($event);
  		$this->until[] = $event;
  		end($this->until);
  		$event_key = key($this->until);
  		reset($this->until);
  		$this->until_count[$event_key] = 0;
  		$updated = '';
  		while(!$this->disconnected and $this->until_count[$event_key] < 1 and (time() - $start < $timeout or $timeout == -1)) {
  			$this->__process();
  		}
  		if(array_key_exists($event_key, $this->until_payload)) {
  			$payload = $this->until_payload[$event_key];
  			unset($this->until_payload[$event_key]);
  			unset($this->until_count[$event_key]);
  			unset($this->until[$event_key]);
  		} else {
  			$payload = array();
  		}
  		return $payload;
  	}
code: public function processUntil($event, $timeout=-1) {
  		$start = time();
  		if(!is_array($event)) $event = array($event);
  		$this->until[] = $event;
  		end($this->until);
  		$event_key = key($this->until);
  		reset($this->until);
  		$this->until_count[$event_key] = 0;
  		$updated = '';
  		while(!$this->disconnected and $this->until_count[$event_key] < 1 and (time() - $start < $timeout or $timeout == -1)) {
  			$this->__process();
  		}
  		if(array_key_exists($event_key, $this->until_payload)) {
  			$payload = $this->until_payload[$event_key];
  			unset($this->until_payload[$event_key]);
  			unset($this->until_count[$event_key]);
  			unset($this->until[$event_key]);
  		} else {
  			$payload = array();
  		}
  		return $payload;
  	}
code_tokens: public function processUntil ( $ event , $ timeout = - 1 ) { $ start = time ( ) ; if ( ! is_array ( $ event ) ) $ event = array ( $ event ) ; $ this -> until [ ] = $ event ; end ( $ this -> until ) ; $ event_key = key ( $ this -> until ) ; reset ( $ this -> until ) ; $ this -> until_count [ $ event_key ] = 0 ; $ updated = '' ; while ( ! $ this -> disconnected and $ this -> until_count [ $ event_key ] < 1 and ( time ( ) - $ start < $ timeout or $ timeout == - 1 ) ) { $ this -> __process ( ) ; } if ( array_key_exists ( $ event_key , $ this -> until_payload ) ) { $ payload = $ this -> until_payload [ $ event_key ] ; unset ( $ this -> until_payload [ $ event_key ] ) ; unset ( $ this -> until_count [ $ event_key ] ) ; unset ( $ this -> until [ $ event_key ] ) ; } else { $ payload = array ( ) ; } return $ payload ; }
docstring: Process until a specified event or a timeout occurs
  
  @param string|array $event
  @param integer $timeout
  @return string
docstring_tokens: Process until a specified event or a timeout occurs