public function getAcceptedContentTypes()
    {
        if (empty($this->acceptedContentTypes)) {
            // Values will be stored in this array
            $this->acceptedContentTypes = array();

            // Accept header is case insensitive, and whitespace isn’t important.
            $acceptHeader = strtolower(str_replace(' ', '', @$_SERVER['HTTP_ACCEPT'] ?: '*/*'));
            // Extract the content types from the header.
            $acceptHeaderItems = explode(',', $acceptHeader);
            foreach ($acceptHeaderItems as $contentType) {
                // The default quality is 1.
                $quality = 1;
                // Check whether a quality is specified.
                if (strpos($contentType, ';q=')) {
                    list($contentType, $quality) = explode(';q=', $contentType);
                }

                $this->acceptedContentTypes[$contentType] = $quality;
            }
            // Sort the content types by relevance.
            arsort($this->acceptedContentTypes);
        }

        return $this->acceptedContentTypes;
    }