public static function compareAccept(string $accept, array $available)
    {
        $result = [];
        foreach (static::parseAccept($accept) as $type => $priority) {
            if (strpos($type, '*') === false) {
                if (in_array($type, $available)) {
                    $result[$type] = max($result[$type] ?? 0, $priority);
                }
            } else {
                foreach ($available as $available_type) {
                    if (fnmatch($type, $available_type)) {
                        $result[$available_type] = max(
                            $result[$available_type] ?? 0,
                            $priority
                        );
                    }
                }
            }
        }
        return $result;
    }
public static function compareAccept(string $accept, array $available)
    {
        $result = [];
        foreach (static::parseAccept($accept) as $type => $priority) {
            if (strpos($type, '*') === false) {
                if (in_array($type, $available)) {
                    $result[$type] = max($result[$type] ?? 0, $priority);
                }
            } else {
                foreach ($available as $available_type) {
                    if (fnmatch($type, $available_type)) {
                        $result[$available_type] = max(
                            $result[$available_type] ?? 0,
                            $priority
                        );
                    }
                }
            }
        }
        return $result;
    }
public static function compareAccept ( string $ accept , array $ available ) { $ result = [ ] ; foreach ( static :: parseAccept ( $ accept ) as $ type => $ priority ) { if ( strpos ( $ type , '*' ) === false ) { if ( in_array ( $ type , $ available ) ) { $ result [ $ type ] = max ( $ result [ $ type ] ?? 0 , $ priority ) ; } } else { foreach ( $ available as $ available_type ) { if ( fnmatch ( $ type , $ available_type ) ) { $ result [ $ available_type ] = max ( $ result [ $ available_type ] ?? 0 , $ priority ) ; } } } } return $ result ; }
Compares content types in an Accept header with a list of available types

@param string   $accept    Accept header
@param string[] $available Available content types

@return float[] With 'type' => priority
Compares content types in an Accept header with a list of available types