public static function checkAccept(array $allowTypes = [])
    {
        $accept = self::getAccept();

        // if no parameter was passed, just return first mime type from parsed data
        if (empty($allowTypes)) {
            return current(array_keys($accept));
        }

        $allowTypes = array_map('strtolower', $allowTypes);

        // let’s check our supported types:
        foreach ($accept as $mime => $quality) {
            if ($quality && \in_array($mime, $allowTypes, true)) {
                return $mime;
            }
        }
        // no mime-type found
        return false;
    }
public static function checkAccept(array $allowTypes = [])
    {
        $accept = self::getAccept();

        // if no parameter was passed, just return first mime type from parsed data
        if (empty($allowTypes)) {
            return current(array_keys($accept));
        }

        $allowTypes = array_map('strtolower', $allowTypes);

        // let’s check our supported types:
        foreach ($accept as $mime => $quality) {
            if ($quality && \in_array($mime, $allowTypes, true)) {
                return $mime;
            }
        }
        // no mime-type found
        return false;
    }
public static function checkAccept ( array $ allowTypes = [ ] ) { $ accept = self :: getAccept ( ) ; // if no parameter was passed, just return first mime type from parsed data if ( empty ( $ allowTypes ) ) { return current ( array_keys ( $ accept ) ) ; } $ allowTypes = array_map ( 'strtolower' , $ allowTypes ) ; // let’s check our supported types: foreach ( $ accept as $ mime => $ quality ) { if ( $ quality && \ in_array ( $ mime , $ allowTypes , true ) ) { return $ mime ; } } // no mime-type found return false ; }
Check Accept header

@param array $allowTypes

@return string|false
Check Accept header