public static function qFactor($value, $level = self::HIGH)
    {
        $multivalues = explode(',', $value);
        $headers = array();

        foreach ($multivalues as $hvalues) {
            if (substr_count($hvalues, ';') > 1) {
                throw new Exception('Header contains a value with multiple semicolons: "' . $value . '"', 2);
            }

            $current = explode(';', $hvalues, 2);

            if (empty($current[1])) {
               $qvalue = 1.0;
            } else {
                $qvalue = self::parseQValue($current[1]);
            }

            $headers[ trim($current[0]) ] = $qvalue;
        }

        $multivalues = null;

        if ($level === self::ALL) {
            return array_keys($headers);
        }

        if ($level === self::LOW) {
            asort($headers, SORT_NUMERIC);
        } else {
            arsort($headers, SORT_NUMERIC);
        }

        return $headers;
    }