src/danog/MadelineProto/Stream/Common/BufferedRawStream.php
public function bufferWrite(string $data): Promise
    {
        if ($this->append_after) {
            $this->append_after -= strlen($data);
            if ($this->append_after === 0) {
                $data .= $this->append;
                $this->append = '';
            } elseif ($this->append_after < 0) {
                $this->append_after = 0;
                $this->append = '';

                throw new Exception('Tried to send too much out of frame data, cannot append');
            }
        }

        return $this->write($data);
    }
public function bufferWrite(string $data): Promise
    {
        if ($this->append_after) {
            $this->append_after -= strlen($data);
            if ($this->append_after === 0) {
                $data .= $this->append;
                $this->append = '';
            } elseif ($this->append_after < 0) {
                $this->append_after = 0;
                $this->append = '';

                throw new Exception('Tried to send too much out of frame data, cannot append');
            }
        }

        return $this->write($data);
    }
public function bufferWrite ( string $ data ) : Promise { if ( $ this -> append_after ) { $ this -> append_after -= strlen ( $ data ) ; if ( $ this -> append_after === 0 ) { $ data .= $ this -> append ; $ this -> append = '' ; } elseif ( $ this -> append_after < 0 ) { $ this -> append_after = 0 ; $ this -> append = '' ; throw new Exception ( 'Tried to send too much out of frame data, cannot append' ) ; } } return $ this -> write ( $ data ) ; }
Async write.

@param string $data Data to write

@return Promise
Async write .