src/sb/JSON/RPC2/Client.php
protected function processResponse($str)
    {

        if (!empty($this->encryption_key)) {
            $str = $this->encryptor->decrypt($str);
        }

        $this->logResponse($str);

        //check if response body is serialized json_response object and just unserialize and return if it is
        if ($this->php_serialize_response && !empty($str)) {

            try {
                $serialized = \unserialize($str);
                if ($serialized !== false) {
                    $response = $serialized;
                }
            } catch (\Exception $e) {

                if ($this->debug) {
                    echo $body;
                }
            }
        }

        //Not sure about this?
        $str = \utf8_encode($str);

        if (!isset($response)) {
            $response = new \sb\JSON\RPC2\Response($str);
        }

        return $response;
    }
protected function processResponse($str)
    {

        if (!empty($this->encryption_key)) {
            $str = $this->encryptor->decrypt($str);
        }

        $this->logResponse($str);

        //check if response body is serialized json_response object and just unserialize and return if it is
        if ($this->php_serialize_response && !empty($str)) {

            try {
                $serialized = \unserialize($str);
                if ($serialized !== false) {
                    $response = $serialized;
                }
            } catch (\Exception $e) {

                if ($this->debug) {
                    echo $body;
                }
            }
        }

        //Not sure about this?
        $str = \utf8_encode($str);

        if (!isset($response)) {
            $response = new \sb\JSON\RPC2\Response($str);
        }

        return $response;
    }
protected function processResponse ( $ str ) { if ( ! empty ( $ this -> encryption_key ) ) { $ str = $ this -> encryptor -> decrypt ( $ str ) ; } $ this -> logResponse ( $ str ) ; //check if response body is serialized json_response object and just unserialize and return if it is if ( $ this -> php_serialize_response && ! empty ( $ str ) ) { try { $ serialized = \ unserialize ( $ str ) ; if ( $ serialized !== false ) { $ response = $ serialized ; } } catch ( \ Exception $ e ) { if ( $ this -> debug ) { echo $ body ; } } } //Not sure about this? $ str = \ utf8_encode ( $ str ) ; if ( ! isset ( $ response ) ) { $ response = new \ sb \ JSON \ RPC2 \ Response ( $ str ) ; } return $ response ; }
Break down the received data into headers and response and then handle gz encoding, encryption, utf, etc
@param $str  The data returned from the socket connection
@return string The body of the message
Break down the received data into headers and response and then handle gz encoding encryption utf etc