src/Http/Request.php
public function accepts()
    {
        $accepts = $this->hasHeader('Accept') ? $this->getHeader('Accept') : ['text/html'];

        foreach ($accepts as $i => $value) {
            list($mime, $q) = preg_split('/;\s*q\s*=\s*/', $value, 2) + [$value, 1.0];
            $stars = substr_count($mime, '*');
            $score = $stars ? (0.03 - $stars * 0.01) : $q;
            $score = $score * 100000 + strlen($mime); //RFC 4288 assumes a max length of 127/127 = 255 chars for mime.
            $preferences[$score][strtolower(trim($mime))] = (float) $q;
        }
        krsort($preferences);
        $preferences = call_user_func_array('array_merge', $preferences);
        return $preferences;
    }
public function accepts()
    {
        $accepts = $this->hasHeader('Accept') ? $this->getHeader('Accept') : ['text/html'];

        foreach ($accepts as $i => $value) {
            list($mime, $q) = preg_split('/;\s*q\s*=\s*/', $value, 2) + [$value, 1.0];
            $stars = substr_count($mime, '*');
            $score = $stars ? (0.03 - $stars * 0.01) : $q;
            $score = $score * 100000 + strlen($mime); //RFC 4288 assumes a max length of 127/127 = 255 chars for mime.
            $preferences[$score][strtolower(trim($mime))] = (float) $q;
        }
        krsort($preferences);
        $preferences = call_user_func_array('array_merge', $preferences);
        return $preferences;
    }
public function accepts ( ) { $ accepts = $ this -> hasHeader ( 'Accept' ) ? $ this -> getHeader ( 'Accept' ) : [ 'text/html' ] ; foreach ( $ accepts as $ i => $ value ) { list ( $ mime , $ q ) = preg_split ( '/;\s*q\s*=\s*/' , $ value , 2 ) + [ $ value , 1.0 ] ; $ stars = substr_count ( $ mime , '*' ) ; $ score = $ stars ? ( 0.03 - $ stars * 0.01 ) : $ q ; $ score = $ score * 100000 + strlen ( $ mime ) ; //RFC 4288 assumes a max length of 127/127 = 255 chars for mime. $ preferences [ $ score ] [ strtolower ( trim ( $ mime ) ) ] = ( float ) $ q ; } krsort ( $ preferences ) ; $ preferences = call_user_func_array ( 'array_merge' , $ preferences ) ; return $ preferences ; }
Return information about the mime of content that the client is requesting.

@param  boolean $all If `true` lists all accepted content mimes
@return mixed        Returns the negotiated mime or the accepted content mimes sorted by
client preference if `$all` is set to `true`.
Return information about the mime of content that the client is requesting .