public function accepts($type)
    {
        foreach ($this->accept as $accept_type => $priority)
        {
            if (strpos($accept_type, "*") !== false)
            {
                $regexp = "/" . str_replace("WC", ".*", preg_quote(str_replace("*", "WC", $accept_type), "/")) . "/i";
                if (preg_match($regexp, $type))
                    return $priority;
            }
            elseif (strtolower($type) === strtolower($accept_type))
                return $priority;
        }

        return 0;
    }
public function accepts($type)
    {
        foreach ($this->accept as $accept_type => $priority)
        {
            if (strpos($accept_type, "*") !== false)
            {
                $regexp = "/" . str_replace("WC", ".*", preg_quote(str_replace("*", "WC", $accept_type), "/")) . "/i";
                if (preg_match($regexp, $type))
                    return $priority;
            }
            elseif (strtolower($type) === strtolower($accept_type))
                return $priority;
        }

        return 0;
    }
public function accepts ( $ type ) { foreach ( $ this -> accept as $ accept_type => $ priority ) { if ( strpos ( $ accept_type , "*" ) !== false ) { $ regexp = "/" . str_replace ( "WC" , ".*" , preg_quote ( str_replace ( "*" , "WC" , $ accept_type ) , "/" ) ) . "/i" ; if ( preg_match ( $ regexp , $ type ) ) return $ priority ; } elseif ( strtolower ( $ type ) === strtolower ( $ accept_type ) ) return $ priority ; } return 0 ; }
Check if a specified response type is accepted by the client. When
no types are specified, everything is accepted.

@param string $type The type of the response that is to be checked
@return float Returns 0 if the type is not accepted, and otherwise the priority
Check if a specified response type is accepted by the client . When no types are specified everything is accepted .