protected function prepareResponse($data, $code)
    {
        $rawHeaders = array();
        $rawContent = null;
        
        $lines = preg_split('/(\\r?\\n)/', $data, -1, PREG_SPLIT_DELIM_CAPTURE);
        for ($i = 0, $count = count($lines); $i < $count; $i += 2) {
            $line = $lines[$i];

            if (!empty($line)) {
                $rawHeaders[] = $line;
            } else {
                $rawContent = implode('', array_slice($lines, $i + 2));
                break;
            }
        }
        
        $headers = $this->prepareHeaders($rawHeaders);

        return new Response($rawContent, $code, $headers);
    }
protected function prepareResponse($data, $code)
    {
        $rawHeaders = array();
        $rawContent = null;
        
        $lines = preg_split('/(\\r?\\n)/', $data, -1, PREG_SPLIT_DELIM_CAPTURE);
        for ($i = 0, $count = count($lines); $i < $count; $i += 2) {
            $line = $lines[$i];

            if (!empty($line)) {
                $rawHeaders[] = $line;
            } else {
                $rawContent = implode('', array_slice($lines, $i + 2));
                break;
            }
        }
        
        $headers = $this->prepareHeaders($rawHeaders);

        return new Response($rawContent, $code, $headers);
    }
protected function prepareResponse ( $ data , $ code ) { $ rawHeaders = array ( ) ; $ rawContent = null ; $ lines = preg_split ( '/(\\r?\\n)/' , $ data , - 1 , PREG_SPLIT_DELIM_CAPTURE ) ; for ( $ i = 0 , $ count = count ( $ lines ) ; $ i < $ count ; $ i += 2 ) { $ line = $ lines [ $ i ] ; if ( ! empty ( $ line ) ) { $ rawHeaders [ ] = $ line ; } else { $ rawContent = implode ( '' , array_slice ( $ lines , $ i + 2 ) ) ; break ; } } $ headers = $ this -> prepareHeaders ( $ rawHeaders ) ; return new Response ( $ rawContent , $ code , $ headers ) ; }
Generate the response object out of the raw response

@param string $data Raw response
@param int    $code HTTP status code

@return \apiTalk\Response The response object
Generate the response object out of the raw response