private function processData($data)
    {
        if ($this->currentMessage) {
            $overflow = $this->currentMessage->parseData($data);
            // json_encode can slow things down here
            //$this->debug("onData: " . json_encode($overflow) . "");
            if ($overflow === false) {
                // there was not enough data to complete the message
                // leave this as the currentParser
                return '';
            }

            $this->handleMessage($this->currentMessage);

            $this->currentMessage = null;

            return $overflow;
        }

        if (strlen($data) == 0) {
            return '';
        }

        $type = $data[0];

        $message = Message::createMessageFromIdentifier($type);
        if ($message !== false) {
            $this->currentMessage = $message;
            return $data;
        }

//        if (in_array($type, ['R', 'S', 'D', 'K', '2', '3', 'C', 'd', 'c', 'G', 'H', 'W', 'D', 'I', 'E', 'V', 'n', 'N', 'A', 't', '1', 's', 'Z', 'T'])) {
//            $this->currentParser = [$this, 'parse1PlusLenMessage'];
//            call_user_func($this->currentParser, $data);
//        } else {
//            echo "Unhandled message \"".$type."\"";
//        }
    }
private function processData($data)
    {
        if ($this->currentMessage) {
            $overflow = $this->currentMessage->parseData($data);
            // json_encode can slow things down here
            //$this->debug("onData: " . json_encode($overflow) . "");
            if ($overflow === false) {
                // there was not enough data to complete the message
                // leave this as the currentParser
                return '';
            }

            $this->handleMessage($this->currentMessage);

            $this->currentMessage = null;

            return $overflow;
        }

        if (strlen($data) == 0) {
            return '';
        }

        $type = $data[0];

        $message = Message::createMessageFromIdentifier($type);
        if ($message !== false) {
            $this->currentMessage = $message;
            return $data;
        }

//        if (in_array($type, ['R', 'S', 'D', 'K', '2', '3', 'C', 'd', 'c', 'G', 'H', 'W', 'D', 'I', 'E', 'V', 'n', 'N', 'A', 't', '1', 's', 'Z', 'T'])) {
//            $this->currentParser = [$this, 'parse1PlusLenMessage'];
//            call_user_func($this->currentParser, $data);
//        } else {
//            echo "Unhandled message \"".$type."\"";
//        }
    }
private function processData ( $ data ) { if ( $ this -> currentMessage ) { $ overflow = $ this -> currentMessage -> parseData ( $ data ) ; // json_encode can slow things down here //$this->debug("onData: " . json_encode($overflow) . ""); if ( $ overflow === false ) { // there was not enough data to complete the message // leave this as the currentParser return '' ; } $ this -> handleMessage ( $ this -> currentMessage ) ; $ this -> currentMessage = null ; return $ overflow ; } if ( strlen ( $ data ) == 0 ) { return '' ; } $ type = $ data [ 0 ] ; $ message = Message :: createMessageFromIdentifier ( $ type ) ; if ( $ message !== false ) { $ this -> currentMessage = $ message ; return $ data ; } //        if (in_array($type, ['R', 'S', 'D', 'K', '2', '3', 'C', 'd', 'c', 'G', 'H', 'W', 'D', 'I', 'E', 'V', 'n', 'N', 'A', 't', '1', 's', 'Z', 'T'])) { //            $this->currentParser = [$this, 'parse1PlusLenMessage']; //            call_user_func($this->currentParser, $data); //        } else { //            echo "Unhandled message \"".$type."\""; //        } }
Data processing callback
@param mixed $data
@return bool|string
Data processing callback