Net/Notifier/WebSocket/Frame.php
protected function parseData($data)
    {
        $length = mb_strlen($data, '8bit');

        if ($this->cursor + $length > $this->getLength() + $this->headerLength) {
            $dataLength = $this->getLength()
                - $this->cursor
                + $this->headerLength;
        } else {
            $dataLength = $length;
        }

        $data     = mb_substr($data, 0, $dataLength, '8bit');
        $leftover = mb_substr($data, $length, $length - $dataLength, '8bit');

        $this->data .= $data;
        if ($this->isMasked()) {
            $this->unmaskedData .= $this->mask($data);
        } else {
            $this->unmaskedData .= $data;
        }
        $this->cursor += mb_strlen($data, '8bit');

        return $leftover;
    }
protected function parseData($data)
    {
        $length = mb_strlen($data, '8bit');

        if ($this->cursor + $length > $this->getLength() + $this->headerLength) {
            $dataLength = $this->getLength()
                - $this->cursor
                + $this->headerLength;
        } else {
            $dataLength = $length;
        }

        $data     = mb_substr($data, 0, $dataLength, '8bit');
        $leftover = mb_substr($data, $length, $length - $dataLength, '8bit');

        $this->data .= $data;
        if ($this->isMasked()) {
            $this->unmaskedData .= $this->mask($data);
        } else {
            $this->unmaskedData .= $data;
        }
        $this->cursor += mb_strlen($data, '8bit');

        return $leftover;
    }
protected function parseData ( $ data ) { $ length = mb_strlen ( $ data , '8bit' ) ; if ( $ this -> cursor + $ length > $ this -> getLength ( ) + $ this -> headerLength ) { $ dataLength = $ this -> getLength ( ) - $ this -> cursor + $ this -> headerLength ; } else { $ dataLength = $ length ; } $ data = mb_substr ( $ data , 0 , $ dataLength , '8bit' ) ; $ leftover = mb_substr ( $ data , $ length , $ length - $ dataLength , '8bit' ) ; $ this -> data .= $ data ; if ( $ this -> isMasked ( ) ) { $ this -> unmaskedData .= $ this -> mask ( $ data ) ; } else { $ this -> unmaskedData .= $ data ; } $ this -> cursor += mb_strlen ( $ data , '8bit' ) ; return $ leftover ; }
Parses the data payload of this frame from a raw data stream

If this frame is masked, the data is unmasked as it is parsed according
to RFC 6455 section 5.3.

@param string $data the raw data.

@return string any remaining unparsed data not belonging to this frame.
Parses the data payload of this frame from a raw data stream