public function read($length = 1)
    {

        if (($length + $this->index) > $this->length) {
            throw new Exception("Unable to read length={$length} from buffer.  Bad protocol format or return?");
        }

        $string = substr($this->data, $this->index, $length);
        $this->index += $length;

        return $string;
    }
public function read($length = 1)
    {

        if (($length + $this->index) > $this->length) {
            throw new Exception("Unable to read length={$length} from buffer.  Bad protocol format or return?");
        }

        $string = substr($this->data, $this->index, $length);
        $this->index += $length;

        return $string;
    }
public function read ( $ length = 1 ) { if ( ( $ length + $ this -> index ) > $ this -> length ) { throw new Exception ( "Unable to read length={$length} from buffer.  Bad protocol format or return?" ) ; } $ string = substr ( $ this -> data , $ this -> index , $ length ) ; $ this -> index += $ length ; return $ string ; }
Read from the buffer

@param int $length

@return string
@throws \GameQ\Exception\Protocol
Read from the buffer