protected function getHttpResponse($status, array $headers = [])
    {
        if (array_key_exists($status, self::HTTP_RESPONSES)) {
            $response = self::HTTP_RESPONSES[$status];
        } else {
            $response = self::HTTP_RESPONSES[self::HTTP_NOT_IMPLEMENTED];
        }

        $handshake = [
            sprintf(self::RESPONSE_LINE_FORMAT, $status, $response),
        ];

        foreach ($headers as $name => $value) {
            $handshake[] = sprintf(self::HEADER_LINE_FORMAT, $name, $value);
        }

        return implode($handshake, "\r\n") . "\r\n\r\n";
    }
protected function getHttpResponse($status, array $headers = [])
    {
        if (array_key_exists($status, self::HTTP_RESPONSES)) {
            $response = self::HTTP_RESPONSES[$status];
        } else {
            $response = self::HTTP_RESPONSES[self::HTTP_NOT_IMPLEMENTED];
        }

        $handshake = [
            sprintf(self::RESPONSE_LINE_FORMAT, $status, $response),
        ];

        foreach ($headers as $name => $value) {
            $handshake[] = sprintf(self::HEADER_LINE_FORMAT, $name, $value);
        }

        return implode($handshake, "\r\n") . "\r\n\r\n";
    }
protected function getHttpResponse ( $ status , array $ headers = [ ] ) { if ( array_key_exists ( $ status , self :: HTTP_RESPONSES ) ) { $ response = self :: HTTP_RESPONSES [ $ status ] ; } else { $ response = self :: HTTP_RESPONSES [ self :: HTTP_NOT_IMPLEMENTED ] ; } $ handshake = [ sprintf ( self :: RESPONSE_LINE_FORMAT , $ status , $ response ) , ] ; foreach ( $ headers as $ name => $ value ) { $ handshake [ ] = sprintf ( self :: HEADER_LINE_FORMAT , $ name , $ value ) ; } return implode ( $ handshake , "\r\n" ) . "\r\n\r\n" ; }
Gets an HTTP response

@param int   $status
@param array $headers
@return string
Gets an HTTP response