RestClient::get_response_format PHP 메소드

get_response_format() 공개 메소드

public get_response_format ( )
    public function get_response_format()
    {
        if (!$this->response) {
            throw new RestClientException("A response must exist before it can be decoded.");
        }
        // User-defined format.
        if (!empty($this->options['format'])) {
            return $this->options['format'];
        }
        // Extract format from response content-type header.
        if (!empty($this->headers->content_type)) {
            if (preg_match($this->options['format_regex'], $this->headers->content_type, $matches)) {
                return $matches[2];
            }
        }
        throw new RestClientException("Response format could not be determined.");
    }