lithium\action\Request::_parseAccept PHP Method

_parseAccept() protected method

Parses the HTTP_ACCEPT information the requesting client sends, and converts that data to an array for consumption by the rest of the framework.
protected _parseAccept ( ) : array
return array All the types of content the client can accept.
    protected function _parseAccept()
    {
        $accept = $this->env('HTTP_ACCEPT');
        $accept = preg_match('/[a-z,-]/i', $accept) ? explode(',', $accept) : array('text/html');
        foreach (array_reverse($accept) as $i => $type) {
            unset($accept[$i]);
            list($type, $q) = explode(';q=', $type, 2) + array($type, 1.0 + $i / 100);
            $accept[$type] = $type === '*/*' ? 0.1 : floatval($q);
        }
        arsort($accept, SORT_NUMERIC);
        if (isset($accept['application/xhtml+xml']) && $accept['application/xhtml+xml'] >= 1) {
            unset($accept['application/xml']);
        }
        $media = $this->_classes['media'];
        if (isset($this->params['type']) && ($handler = $media::type($this->params['type']))) {
            if (isset($handler['content'])) {
                $type = (array) $handler['content'];
                $accept = array(current($type) => 1) + $accept;
            }
        }
        return array_keys($accept);
    }