Esempio n. 1
0
 /**
  * Shifts the given data back to the front of the stream and will be the first bytes returned from any pending or
  * subsequent read.
  *
  * @param string $data
  */
 public function unshift(string $data)
 {
     if (!strlen($data)) {
         return;
     }
     $this->buffer->unshift($data);
     if (null !== $this->delayed && !$this->buffer->isEmpty()) {
         $delayed = $this->delayed;
         $this->delayed = null;
         $delayed->resolve($this->remove());
     }
 }